diff --git a/app/client/.eslintrc.js b/app/client/.eslintrc.js index 431c668da0..0c7790a867 100644 --- a/app/client/.eslintrc.js +++ b/app/client/.eslintrc.js @@ -18,6 +18,7 @@ module.exports = { "@typescript-eslint/explicit-function-return-type": 0, "@typescript-eslint/no-explicit-any": 0, "react-hooks/rules-of-hooks": "error", + "@typescript-eslint/no-use-before-define": 0, }, settings: { react: { diff --git a/app/client/src/utils/DynamicBindingUtils.ts b/app/client/src/utils/DynamicBindingUtils.ts index 4dfe5e96dd..a3fd33cdfe 100644 --- a/app/client/src/utils/DynamicBindingUtils.ts +++ b/app/client/src/utils/DynamicBindingUtils.ts @@ -117,7 +117,26 @@ export const getDynamicValue = ( if (bindings.length) { // Get the Data Tree value of those "binding "paths const values = paths.map((p, i) => { - return p ? evaluateDynamicBoundValue(data, p) : bindings[i]; + if (p) { + const value = evaluateDynamicBoundValue(data, p); + // Check if the result is a dynamic value, if so get the value again + if (isDynamicValue(value)) { + // Check for the paths of this dynamic value + const { paths } = getDynamicBindings(value); + // If it is the same as it came in, log an error + // and return the same value back + if (paths.length === 1 && paths[0] === p) { + console.error("Binding not correct"); + return value; + } + // Evaluate the value again + return getDynamicValue(value, data); + } else { + return value; + } + } else { + return bindings[i]; + } }); // if it is just one binding, no need to create template string