mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-26 08:11:08 -05:00
Fix null safety issues
This commit is contained in:
@@ -30,9 +30,12 @@ export function ValidationSummary({ item, onValidationChange, compact = false, v
|
||||
// Helper to extract the correct entity ID based on entity type
|
||||
const getEntityId = (
|
||||
itemType: string,
|
||||
itemData: SubmissionItemData,
|
||||
itemData: SubmissionItemData | null | undefined,
|
||||
fallbackId?: string
|
||||
): string | undefined => {
|
||||
// Guard against null/undefined itemData
|
||||
if (!itemData) return fallbackId;
|
||||
|
||||
// Try entity-specific ID fields first
|
||||
const entityIdField = `${itemType}_id`;
|
||||
const typedData = itemData as unknown as Record<string, unknown>;
|
||||
@@ -84,7 +87,7 @@ export function ValidationSummary({ item, onValidationChange, compact = false, v
|
||||
const result = await validateEntityData(
|
||||
item.item_type as ValidEntityType,
|
||||
{
|
||||
...item.item_data,
|
||||
...(item.item_data || {}), // Add null coalescing
|
||||
id: getEntityId(item.item_type, item.item_data, item.id)
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user