-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: change the klona strategy of setting of values to evalTree and evalActionBindings #38033
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1207,7 +1207,7 @@ export default class DataTreeEvaluator { | |||||||||||||
); | ||||||||||||||
|
||||||||||||||
set(contextTree, fullPropertyPath, parsedValue); | ||||||||||||||
set(safeTree, fullPropertyPath, klona(parsedValue)); | ||||||||||||||
set(safeTree, fullPropertyPath, klonaJSON(parsedValue)); | ||||||||||||||
|
||||||||||||||
staleMetaIds = staleMetaIds.concat( | ||||||||||||||
getStaleMetaStateIds({ | ||||||||||||||
|
@@ -1253,7 +1253,7 @@ export default class DataTreeEvaluator { | |||||||||||||
if (!requiresEval) continue; | ||||||||||||||
|
||||||||||||||
set(contextTree, fullPropertyPath, evalPropertyValue); | ||||||||||||||
set(safeTree, fullPropertyPath, klona(evalPropertyValue)); | ||||||||||||||
set(safeTree, fullPropertyPath, klonaJSON(evalPropertyValue)); | ||||||||||||||
break; | ||||||||||||||
} | ||||||||||||||
case ENTITY_TYPE.JSACTION: { | ||||||||||||||
|
@@ -1290,7 +1290,7 @@ export default class DataTreeEvaluator { | |||||||||||||
* Their evaluated values need to be reset only when the variable is modified by the user. | ||||||||||||||
* When uneval value of a js variable hasn't changed, it means that the previously evaluated values are in both trees already */ | ||||||||||||||
if (!skipVariableValueAssignment) { | ||||||||||||||
const valueForSafeTree = klona(evalValue); | ||||||||||||||
const valueForSafeTree = klonaJSON(evalValue); | ||||||||||||||
|
||||||||||||||
set(contextTree, fullPropertyPath, evalValue); | ||||||||||||||
set(safeTree, fullPropertyPath, valueForSafeTree); | ||||||||||||||
|
@@ -1305,7 +1305,7 @@ export default class DataTreeEvaluator { | |||||||||||||
} | ||||||||||||||
default: | ||||||||||||||
set(contextTree, fullPropertyPath, evalPropertyValue); | ||||||||||||||
set(safeTree, fullPropertyPath, klona(evalPropertyValue)); | ||||||||||||||
set(safeTree, fullPropertyPath, klonaJSON(evalPropertyValue)); | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Ensure fallback handling for non-JSON types The default case now uses - set(safeTree, fullPropertyPath, klonaJSON(evalPropertyValue));
+ try {
+ set(safeTree, fullPropertyPath, klonaJSON(evalPropertyValue));
+ } catch (e) {
+ set(safeTree, fullPropertyPath, klona(evalPropertyValue));
+ } 📝 Committable suggestion
Suggested change
|
||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
} catch (error) { | ||||||||||||||
|
@@ -1793,7 +1793,7 @@ export default class DataTreeEvaluator { | |||||||||||||
bindings: string[], | ||||||||||||||
executionParams?: Record<string, unknown> | string, | ||||||||||||||
) { | ||||||||||||||
const dataTree = klona(this.evalTree); | ||||||||||||||
const dataTree = klonaJSON(this.evalTree); | ||||||||||||||
// We might get execution params as an object or as a string. | ||||||||||||||
// If the user has added a proper object (valid case) it will be an object | ||||||||||||||
// If they have not added any execution params or not an object | ||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rishabhrathod01 What are the allowed dataTypes for jsobject variables? We need to check if all these datatypes are supported by
klonaJSON
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string, boolean, number, object, array, map and set are the main dataTypes that are supposed to be supported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please test for map, set and date object @vsvamsi1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure can you suggest some test scenarios for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create all types variables in jsobject and try to read and update them through the app. Check if you see anomalies.