From 2ca2fc0f6a9fcf27753c9aa830f9c521d141fb8f Mon Sep 17 00:00:00 2001 From: igorrCarvalho Date: Tue, 16 Jan 2024 18:55:59 -0300 Subject: [PATCH] Fix: Transform empty object to array without opening 'editNode' modal to prevent flow build breakage. --- src/frontend/src/utils/reactflowUtils.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/frontend/src/utils/reactflowUtils.ts b/src/frontend/src/utils/reactflowUtils.ts index 7c8a0b7c0..8d222349a 100644 --- a/src/frontend/src/utils/reactflowUtils.ts +++ b/src/frontend/src/utils/reactflowUtils.ts @@ -474,6 +474,8 @@ export function convertArrayToObj(arrayOfObjects) { export function hasDuplicateKeys(array) { const keys = {}; + // Transforms an empty object into an object array without opening the 'editNode' modal to prevent the flow build from breaking. + if (!Array.isArray(array)) array = [{"": ""}]; for (const obj of array) { for (const key in obj) { if (keys[key]) { @@ -486,6 +488,8 @@ export function hasDuplicateKeys(array) { } export function hasEmptyKey(objArray) { + // Transforms an empty object into an array without opening the 'editNode' modal to prevent the flow build from breaking. + if (!Array.isArray(objArray)) objArray = []; for (const obj of objArray) { for (const key in obj) { if (obj.hasOwnProperty(key) && key === "") {