From 4b61a582ba07b958a23d776f645496f877dcd98e Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Mon, 18 Sep 2023 11:25:18 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20fix(constants.ts):=20fix=20inden?= =?UTF-8?q?tation=20issue=20in=20CODE=5FDICT=5FDIALOG=5FSUBTITLE=20constan?= =?UTF-8?q?t=20=F0=9F=94=A7=20fix(constants.ts):=20update=20CODE=5FDICT=5F?= =?UTF-8?q?DIALOG=5FSUBTITLE=20constant=20to=20include=20information=20abo?= =?UTF-8?q?ut=20using=20eval()=20function=20=F0=9F=94=A7=20fix(reactflowUt?= =?UTF-8?q?ils.ts):=20add=20check=20to=20convertObjToArray=20function=20to?= =?UTF-8?q?=20return=20the=20input=20if=20it=20is=20already=20an=20array?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/constants/constants.ts | 4 ++-- src/frontend/src/utils/reactflowUtils.ts | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/constants/constants.ts b/src/frontend/src/constants/constants.ts index ab87f1e01..2e48b5b32 100644 --- a/src/frontend/src/constants/constants.ts +++ b/src/frontend/src/constants/constants.ts @@ -115,9 +115,9 @@ export const EDIT_DIALOG_SUBTITLE = export const CODE_PROMPT_DIALOG_SUBTITLE = "Edit your Python code. This code snippet accepts module import and a single function definition. Make sure that your function returns a string."; - + export const CODE_DICT_DIALOG_SUBTITLE = -"Edit your dictionary. This dialog allows you to create your own customized dictionary. You can add as many key-value pairs as you want."; + "Edit your dictionary. This dialog allows you to create your own customized dictionary. You can add as many key-value pairs as you want. The editor uses eval(). While in edit mode, you can enter ({}) or ([]), which will cause the result of eval to become a new object or array."; /** * The base text for subtitle of Prompt Dialog diff --git a/src/frontend/src/utils/reactflowUtils.ts b/src/frontend/src/utils/reactflowUtils.ts index aebf36eab..da503befc 100644 --- a/src/frontend/src/utils/reactflowUtils.ts +++ b/src/frontend/src/utils/reactflowUtils.ts @@ -292,6 +292,9 @@ export function getConnectedNodes( } export function convertObjToArray(singleObject) { + + if (Array.isArray(singleObject)) return singleObject; + let arrConverted: any = []; for (const key in singleObject) { if (singleObject.hasOwnProperty(key)) {