Merge branch 'fix/recursive-dynamic-binding-resolution' into 'release'
Recursive dynamic binding resolution Fixes: #299 See merge request theappsmith/internal-tools-client!207
This commit is contained in:
commit
a7529e78d3
|
|
@ -18,6 +18,7 @@ module.exports = {
|
||||||
"@typescript-eslint/explicit-function-return-type": 0,
|
"@typescript-eslint/explicit-function-return-type": 0,
|
||||||
"@typescript-eslint/no-explicit-any": 0,
|
"@typescript-eslint/no-explicit-any": 0,
|
||||||
"react-hooks/rules-of-hooks": "error",
|
"react-hooks/rules-of-hooks": "error",
|
||||||
|
"@typescript-eslint/no-use-before-define": 0,
|
||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
react: {
|
react: {
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,26 @@ export const getDynamicValue = (
|
||||||
if (bindings.length) {
|
if (bindings.length) {
|
||||||
// Get the Data Tree value of those "binding "paths
|
// Get the Data Tree value of those "binding "paths
|
||||||
const values = paths.map((p, i) => {
|
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
|
// if it is just one binding, no need to create template string
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user