Fix TypeError when fieldMetadataItem is undefined in RecordTableCellFieldContextWrapper

Add null guard for fieldMetadataItem lookup from fieldMetadataItemByFieldMetadataItemId
map. When a recordField's fieldMetadataItemId doesn't exist in the map (e.g. during
navigation away from a record table view), the lookup returns undefined and accessing
.name on it throws "Cannot read properties of undefined (reading 'name')".

Sentry issue: https://sentry.io/issues/6918487847/

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sonarly Claude Code
2026-02-20 03:25:43 +00:00
co-authored by Claude Opus 4.6
parent 783e57f5d8
commit 0e081fe590
@@ -27,6 +27,10 @@ export const RecordTableCellFieldContextWrapper = ({
const fieldMetadataItem =
fieldMetadataItemByFieldMetadataItemId[recordField.fieldMetadataItemId];
if (!fieldMetadataItem) {
return null;
}
const instanceId = getRecordFieldInputInstanceId({
recordId,
fieldName: fieldMetadataItem.name,