Files
twenty/packages
Sonarly Claude Code 5c16d2e79e fix: guard against undefined fieldMetadataItem in RecordTableCellFieldContextWrapper
https://sonarly.com/issue/19112?type=bug

RecordTableCellFieldContextWrapper crashes with TypeError when a record field references a fieldMetadataItemId that doesn't exist in the field metadata map, causing the workflows table view to fail to render.

Fix: Added `isDefined` null guards in three record table cell components that look up field metadata/definitions from maps by `fieldMetadataItemId` without checking for `undefined`:

1. **`RecordTableCellFieldContextWrapper.tsx`** — guards `fieldMetadataItem` before accessing `.name` (the exact crash site from the Sentry error)
2. **`RecordTableCellFieldContextGeneric.tsx`** — guards `fieldDefinition` before accessing `.metadata`, `.fieldMetadataId`, etc.
3. **`RecordTableCellFieldContextLabelIdentifier.tsx`** — guards `fieldDefinition` before accessing `.metadata.isUIReadOnly`, etc.

All three use early `return null` when the lookup returns `undefined`, which safely skips rendering the cell during transient metadata synchronization states. This matches the existing defensive pattern in `useRelevantRecordsGqlFields.ts` which uses `.filter(isDefined)` after the same kind of map lookup.

The `isDefined` utility from `twenty-shared/utils` is the team's standard null check (already imported in `RecordTableCellFieldContextGeneric.tsx`; added as new import to the other two files).
2026-03-27 18:07:57 +00:00
..
2026-03-23 16:56:15 +00:00