Skip to content

Commit

Permalink
fix: Add default props dependency in dependency map (appsmithorg#9418)
Browse files Browse the repository at this point in the history
* Add cloneDeep
* Add comments
  • Loading branch information
rishabhrathod01 committed Nov 29, 2021
1 parent 669d901 commit bddafdc
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions app/client/src/workers/DataTreeEvaluator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,21 @@ export default class DataTreeEvaluator {
this.widgetConfigMap = widgetConfigMap;
}

/**
* This method takes unEvalTree as input and does following
* 1. parseJSActions and updates JS
* 2. Creates dependencyMap, sorted dependencyMap
* 3. Generates inverseDependencyTree
* 4. Finally, evaluates the unEvalTree and returns that with JSUpdates
*
* @param {DataTree} unEvalTree
* @return {*}
* @memberof DataTreeEvaluator
*/
createFirstTree(unEvalTree: DataTree) {
const totalStart = performance.now();
let localUnEvalTree = JSON.parse(JSON.stringify(unEvalTree));
// cloneDeep will make sure not to omit key which has value as undefined.
let localUnEvalTree = _.cloneDeep(unEvalTree);
let jsUpdates: Record<string, JSUpdate> = {};
//parse js collection to get functions
//save current state of js collection action and variables to be added to uneval tree
Expand Down Expand Up @@ -129,7 +141,7 @@ export default class DataTreeEvaluator {
this.evalTree = getValidatedTree(evaluatedTree);
const validateEnd = performance.now();

this.oldUnEvalTree = JSON.parse(JSON.stringify(localUnEvalTree));
this.oldUnEvalTree = _.cloneDeep(localUnEvalTree);
const totalEnd = performance.now();
const timeTakenForFirstTree = {
total: (totalEnd - totalStart).toFixed(2),
Expand Down

0 comments on commit bddafdc

Please sign in to comment.