From f45afd9c8fd2aa0c6935fc8ef615e69b9a367f14 Mon Sep 17 00:00:00 2001 From: arunvjn <32433245+arunvjn@users.noreply.github.com> Date: Mon, 3 Apr 2023 11:33:03 +0530 Subject: [PATCH] chore: modify getAllPaths utility method to only create child records for native objects (#21998) --- app/client/src/ce/workers/Evaluation/evaluationUtils.test.ts | 2 ++ app/client/src/ce/workers/Evaluation/evaluationUtils.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/client/src/ce/workers/Evaluation/evaluationUtils.test.ts b/app/client/src/ce/workers/Evaluation/evaluationUtils.test.ts index 77312e3ac9..b13288779d 100644 --- a/app/client/src/ce/workers/Evaluation/evaluationUtils.test.ts +++ b/app/client/src/ce/workers/Evaluation/evaluationUtils.test.ts @@ -205,6 +205,7 @@ describe("1. Correctly handle paths", () => { ["1", "2"], ], }, + stringProperty: new String("Hello"), }, }; const result = { @@ -221,6 +222,7 @@ describe("1. Correctly handle paths", () => { "WidgetName.objectProperty.childObjectProperty[3]": true, "WidgetName.objectProperty.childObjectProperty[3][0]": true, "WidgetName.objectProperty.childObjectProperty[3][1]": true, + "WidgetName.stringProperty": true, }; const actual = getAllPaths(myTree); diff --git a/app/client/src/ce/workers/Evaluation/evaluationUtils.ts b/app/client/src/ce/workers/Evaluation/evaluationUtils.ts index 6227f2adf2..6b32900e38 100644 --- a/app/client/src/ce/workers/Evaluation/evaluationUtils.ts +++ b/app/client/src/ce/workers/Evaluation/evaluationUtils.ts @@ -491,7 +491,7 @@ export const getAllPaths = ( const tempKey = curKey ? `${curKey}[${i}]` : `${i}`; getAllPaths(records[i], tempKey, result); } - } else if (typeof records === "object" && records) { + } else if (isTrueObject(records)) { for (const key of Object.keys(records)) { const tempKey = curKey ? `${curKey}.${key}` : `${key}`; getAllPaths(records[key], tempKey, result);