Skip to content

Commit

Permalink
fix:remove linting related code from eval (#24995)
Browse files Browse the repository at this point in the history
## Description
In #23865 , a new
architecture was introduced that makes linting and evaluation
independent. Sequal to that change, this PR removes redundant linting
code from eval code.

- Removes the triggerfield dependencyMap
- Removes the "lint order" generated from eval flow
- Removes "extraPathsToLint"

#### PR fixes following issue(s)
Fixes #23448

#### Type of change
- Chore (housekeeping or task changes that don't impact user perception)

## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [ ] Manual
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
  • Loading branch information
ohansFavour authored Jul 7, 2023
1 parent 99adedf commit 721ea41
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 1,170 deletions.
1 change: 1 addition & 0 deletions app/client/src/entities/DependencyMap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ export default class DependencyMap {
queue.push(n);
}
}

return reachableNodes;
}
}
4 changes: 0 additions & 4 deletions app/client/src/plugins/Linting/linters/worker.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import type { TMessage } from "utils/MessageUtil";
import { MessageType } from "utils/MessageUtil";
import { WorkerMessenger } from "workers/Evaluation/fns/utils/Messenger";
import DependencyMap from "entities/DependencyMap";
import type { LintRequest } from "../types";
import { handlerMap } from "../handlers";

export const triggerFieldDependency = new DependencyMap();
export const actionInDataFieldDependency = new DependencyMap();

export function messageListener(e: MessageEvent<TMessage<LintRequest>>) {
const { messageType } = e.data;
if (messageType !== MessageType.REQUEST) return;
Expand Down
39 changes: 9 additions & 30 deletions app/client/src/workers/common/DataTreeEvaluator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ import {
isObject,
isUndefined,
set,
union,
unset,
} from "lodash";

Expand Down Expand Up @@ -152,7 +151,6 @@ export default class DataTreeEvaluator {
allActionValidationConfig?: {
[actionId: string]: ActionValidationConfigMap;
};
triggerFieldDependencyMap: DependencyMap = {};
/** Keeps track of all invalid references in bindings throughout the Application
* Eg. For binding {{unknownEntity.name + Api1.name}} in Button1.text, where Api1 is present in dataTree but unknownEntity is not,
* the map has a key-value pair of
Expand Down Expand Up @@ -215,7 +213,6 @@ export default class DataTreeEvaluator {
): {
jsUpdates: Record<string, JSUpdate>;
evalOrder: string[];
lintOrder: string[];
} {
const totalFirstTreeSetupStartTime = performance.now();
// cloneDeep will make sure not to omit key which has value as undefined.
Expand Down Expand Up @@ -243,16 +240,11 @@ export default class DataTreeEvaluator {

const createDependencyMapStartTime = performance.now();
// Create dependency map
const {
dependencyMap,
invalidReferencesMap,
triggerFieldDependencyMap,
validationDependencyMap,
} = createDependencyMap(this, localUnEvalTree, configTree);
const { dependencyMap, invalidReferencesMap, validationDependencyMap } =
createDependencyMap(this, localUnEvalTree, configTree);
const createDependencyMapEndTime = performance.now();

this.dependencyMap = dependencyMap;
this.triggerFieldDependencyMap = triggerFieldDependencyMap;
this.invalidReferencesMap = invalidReferencesMap;
this.validationDependencyMap = validationDependencyMap;
const sortDependenciesStartTime = performance.now();
Expand Down Expand Up @@ -312,7 +304,6 @@ export default class DataTreeEvaluator {
return {
jsUpdates,
evalOrder: this.sortedDependencies,
lintOrder: this.sortedDependencies,
};
}

Expand Down Expand Up @@ -394,7 +385,6 @@ export default class DataTreeEvaluator {
): {
unEvalUpdates: DataTreeDiff[];
evalOrder: string[];
lintOrder: string[];
jsUpdates: Record<string, JSUpdate>;
nonDynamicFieldValidationOrder: string[];
pathsToClearErrorsFor: any[];
Expand Down Expand Up @@ -469,7 +459,6 @@ export default class DataTreeEvaluator {
pathsToClearErrorsFor: [],
unEvalUpdates: [],
evalOrder: [],
lintOrder: [],
jsUpdates: {},
nonDynamicFieldValidationOrder: [],
isNewWidgetAdded: false,
Expand Down Expand Up @@ -506,17 +495,13 @@ export default class DataTreeEvaluator {
const updateDependencyStartTime = performance.now();
// Find all the paths that have changed as part of the difference and update the
// global dependency map if an existing dynamic binding has now become legal
const {
dependenciesOfRemovedPaths,
extraPathsToLint,
pathsToClearErrorsFor,
removedPaths,
} = updateDependencyMap({
configTree,
dataTreeEvalRef: this,
translatedDiffs,
unEvalDataTree: localUnEvalTree,
});
const { dependenciesOfRemovedPaths, pathsToClearErrorsFor, removedPaths } =
updateDependencyMap({
configTree,
dataTreeEvalRef: this,
translatedDiffs,
unEvalDataTree: localUnEvalTree,
});
const updateDependencyEndTime = performance.now();

this.updateEvalTreeWithChanges({ differences });
Expand Down Expand Up @@ -545,7 +530,6 @@ export default class DataTreeEvaluator {
totalUpdateTreeSetupStartTime,
dependenciesOfRemovedPaths,
removedPaths,
extraPathsToLint,
translatedDiffs,
pathsToClearErrorsFor,
findDifferenceTime,
Expand Down Expand Up @@ -607,7 +591,6 @@ export default class DataTreeEvaluator {
totalUpdateTreeSetupStartTime?: any;
dependenciesOfRemovedPaths?: string[];
removedPaths?: string[];
extraPathsToLint?: string[];
translatedDiffs?: DataTreeDiff[];
pathsToClearErrorsFor?: any[];
pathsToSkipFromEval?: string[];
Expand All @@ -619,7 +602,6 @@ export default class DataTreeEvaluator {
) {
const {
dependenciesOfRemovedPaths = [],
extraPathsToLint = [],
removedPaths = [],
totalUpdateTreeSetupStartTime = performance.now(),
translatedDiffs = [],
Expand Down Expand Up @@ -656,7 +638,6 @@ export default class DataTreeEvaluator {
inverse: this.inverseDependencyMap,
updatedDependencyMap: this.dependencyMap,
evaluationOrder: evaluationOrder,
triggerFieldDependencyMap: this.triggerFieldDependencyMap,
});

// Remove any deleted paths from the eval tree
Expand Down Expand Up @@ -692,7 +673,6 @@ export default class DataTreeEvaluator {
return {
unEvalUpdates: translatedDiffs,
evalOrder: evaluationOrder,
lintOrder: union(evaluationOrder, extraPathsToLint),
nonDynamicFieldValidationOrder: Array.from(
nonDynamicFieldValidationOrderSet,
),
Expand All @@ -710,7 +690,6 @@ export default class DataTreeEvaluator {
return {
unEvalUpdates: [],
evalOrder: [],
lintOrder: [],
jsUpdates: {},
nonDynamicFieldValidationOrder: [],
pathsToClearErrorsFor: [],
Expand Down
Loading

0 comments on commit 721ea41

Please sign in to comment.