Compare commits

...
Author SHA1 Message Date
Sonarly Claude Code 75bd475209 fix: add RICH_TEXT to FIELD_NOT_OVERWRITTEN_AT_DRAFT to prevent table cell crash
https://sonarly.com/issue/6010?type=bug

Pressing any key while focused on a RICH_TEXT table cell (e.g., Notes body field) throws an unhandled error because `computeDraftValueFromString` has no handler for the RICH_TEXT field type.

Fix: **Two changes, both in `twenty-front`:**

1. **`FieldsNotOverwrittenAtDraft.ts`** — Added `FieldMetadataType.RICH_TEXT` to the `FIELD_NOT_OVERWRITTEN_AT_DRAFT` array, alphabetically between RATING and SELECT.

   This is the primary fix. When a user presses a key while focused on a table cell, `useInitDraftValue` checks this array. If the field type is listed, it uses `computeDraftValueFromFieldValue` (which handles all types via the existing record value) instead of `computeDraftValueFromString` (which tries to convert a single keystroke into a type-specific draft). RICH_TEXT fields use BlockNote/TipTap editors and cannot create a meaningful draft from a single character — same reason ADDRESS, PHONES, LINKS, SELECT, etc. are already in this list.

2. **`computeDraftValueFromString.ts`** — Fixed a stray `}` in the error message template literal. The string was `` `...${fieldDefinition.type}}` `` (double closing brace producing "RICH_TEXT}") instead of `` `...${fieldDefinition.type}` ``.
2026-03-28 15:21:44 +00:00
2 changed files with 2 additions and 1 deletions
@@ -6,6 +6,7 @@ export const FIELD_NOT_OVERWRITTEN_AT_DRAFT = [
FieldMetadataType.LINKS,
FieldMetadataType.MULTI_SELECT,
FieldMetadataType.RATING,
FieldMetadataType.RICH_TEXT,
FieldMetadataType.SELECT,
FieldMetadataType.FILES,
];
@@ -83,7 +83,7 @@ export const computeDraftValueFromString = <FieldValue>({
}
throw new CustomError(
`Record field type not supported : ${fieldDefinition.type}}`,
`Record field type not supported : ${fieldDefinition.type}`,
'RECORD_FIELD_TYPE_NOT_SUPPORTED',
);
};