Fix Raw Json Null Error (#12968)

This pull request refines the `usePersistField` hook in
`usePersistField.ts` to improve handling of raw JSON fields. The changes
ensure that unpersistable raw JSON fields are excluded early in the
logic and simplify the conditions for determining persistable values.

Enhancements to raw JSON field handling:

* Added a conditional check to exit early if the field is both raw JSON
and unpersistable (`usePersistField.ts`).
* Simplified the persistability condition by removing redundant checks
for unpersistable raw JSON fields (`usePersistField.ts`).

---------

Co-authored-by: Baptiste Devessier <baptiste@devessier.fr>
This commit is contained in:
rajatsingh23
2025-07-02 18:38:34 +05:30
committed by GitHub
parent d744ef129e
commit 7f323aaa16

View File

@ -134,6 +134,10 @@ export const usePersistField = () => {
fieldName: fieldDefinition.metadata.fieldName,
});
if (fieldIsRawJson && isUnpersistableRawJsonField) {
return;
}
const isValuePersistable =
fieldIsRelationToOneObject ||
fieldIsText ||
@ -150,7 +154,7 @@ export const usePersistField = () => {
fieldIsSelect ||
fieldIsMultiSelect ||
fieldIsAddress ||
(fieldIsRawJson && !isUnpersistableRawJsonField) ||
fieldIsRawJson ||
fieldIsArray ||
fieldIsRichText ||
fieldIsRichTextV2;