Skip to content

Commit 0ca1e62

Browse files
nsdeschenesclaude
andcommitted
fix(explore): Guard against missing attributes in validation response
Add nullish coalescing fallback when accessing the attributes field from the validation API response. The prior optional chaining on data[0]?.attributes could pass undefined to Object.entries() if the response body lacked an attributes field, causing a TypeError. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c5cec3e commit 0ca1e62

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

static/app/views/explore/hooks/useAttributeValidation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export function useAttributeValidation(
117117
return EMPTY_KEYS;
118118
}
119119

120-
return Object.entries(data?.[0]?.attributes)
120+
return Object.entries(data[0]?.attributes ?? {})
121121
.filter(([, result]) => !result.valid)
122122
.map(([key]) => key);
123123
}, [data, hasValidation]);

0 commit comments

Comments
 (0)