Null equivalence - Fix (#16050)
@charlesBochet In workflow codebase, NULL (instead of empty object) is expected on workflow version object step field, when a new workflow is created for example. (packages/twenty-front/src/modules/workflow/workflow-diagram/utils/generateWorkflowDiagram.ts - 42) This case is not isolated and it creates many issues. We decided to format NULL value to equivalent (empty string for text field, empty object for raw_json) but it seems it complicates the dev x. To unlock @Devessier I prefer revert the logic, the time we discuss how to solve this cases.
This commit is contained in:
+3
-8
@@ -1,6 +1,7 @@
|
||||
import { type FieldMetadataTypesToTestForCreateInputValidation } from 'test/integration/graphql/suites/inputs-validation/types/field-metadata-type-to-test';
|
||||
import { TEST_TARGET_OBJECT_RECORD_ID_FIELD_VALUE } from 'test/integration/graphql/suites/inputs-validation/utils/setup-test-objects-with-all-field-types.util';
|
||||
import { FieldMetadataType } from 'twenty-shared/types';
|
||||
import { isEmptyObject } from 'twenty-shared/utils';
|
||||
|
||||
export const successfulCreateInputByFieldMetadataType: {
|
||||
[K in Exclude<
|
||||
@@ -134,10 +135,7 @@ export const successfulCreateInputByFieldMetadataType: {
|
||||
rawJsonField: {},
|
||||
},
|
||||
validateInput: (record: Record<string, any>) => {
|
||||
return (
|
||||
typeof record.rawJsonField === 'object' &&
|
||||
Object.keys(record.rawJsonField).length === 0
|
||||
);
|
||||
return isEmptyObject(record.rawJsonField);
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -145,10 +143,7 @@ export const successfulCreateInputByFieldMetadataType: {
|
||||
rawJsonField: null,
|
||||
},
|
||||
validateInput: (record: Record<string, any>) => {
|
||||
return (
|
||||
typeof record.rawJsonField === 'object' &&
|
||||
Object.keys(record.rawJsonField).length === 0
|
||||
);
|
||||
return record.rawJsonField === null;
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user