From 77766015e7253a2deb47919b8e17bdb4ee338fdd Mon Sep 17 00:00:00 2001 From: Hamza El Gatia Date: Fri, 3 May 2024 12:03:49 +0100 Subject: [PATCH] fix: field type checks --- packages/core/src/forms/studio/formula.helpers.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/core/src/forms/studio/formula.helpers.ts b/packages/core/src/forms/studio/formula.helpers.ts index ba58dcb5af..90ac19e8d0 100644 --- a/packages/core/src/forms/studio/formula.helpers.ts +++ b/packages/core/src/forms/studio/formula.helpers.ts @@ -52,17 +52,13 @@ export const mapStudioFieldsWithFormula = ( })); }; -export const getAttrsValue = (object: Object, fieldType: string) => { +export const getAttrsValue = (object: Object, fieldType?: string) => { if (isEmpty(object)) { return {}; } - if ( - fieldType != null || - object.hasOwnProperty(fieldType) || - typeof object[fieldType] !== 'string' - ) { - return JSON.parse(object[fieldType]); + if (fieldType != null) { + return object[fieldType] != null ? JSON.parse(object[fieldType]) : {}; } let result = {};