PromucFlow_constructor/app/client/src/workers/Evaluation/helpers.ts

346 lines
11 KiB
TypeScript
Raw Normal View History

chore: send serialised updated and using klona/json instead of klona (#27319) ## Description - We are no longer performing JSON.stringify(JSON.parse(value)) to clone, clean up undefined values and serialised bigInt. - We are performing deepClones using klona/json which is much faster and later we perform the serialisation on the diff. - We are sending serialised updated to the main thread and it is parsed on the main thread, this helps in reducing structuredClone cost of sending unserialised objects. - Noticed a reduction of worker thread latency by about 75% and doubled the databound our app can handle. #### PR fixes following issue(s) Fixes #26130 #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing > #### How Has This Been Tested? - [x] Manual - [x] JUnit - [ ] 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 - [x] My code follows the style guidelines of this project - [x] 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 - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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 - [x] 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 - [x] 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
2023-09-26 12:14:20 +00:00
import { serialiseToBigInt } from "@appsmith/workers/Evaluation/evaluationUtils";
chore: send diff updates from worker (#24933) ## Description - Optimisation around evaluation updates to the state - Updates generation logic moved from main thread to worker thread - The diff between previous state and next state is less exacting to limit the number of updates - Logic to compress similar updates to reduce the diff updates sent from worker thread to main thread - Memoisation fixes and some selector optimisation for improved performance. #### PR fixes following issue(s) Fixes #24866 #### 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 - [x] Manual - [x] 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 - [x] My code follows the style guidelines of this project - [x] 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 - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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
2023-08-16 05:34:32 +00:00
import type { Diff } from "deep-diff";
import { diff } from "deep-diff";
chore: separated tree type into common file to be extended on EE (#27812) ## Description UnEvalTree, dataTree and configTree's entities needs to be extended on EE to accommodate module inputs and different types of modules hence the separation. I have added few more sanity checks in the existing code which were throwing errors/warning on EE. #### PR fixes following issue(s) Fixes # (issue number) #### Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video > > #### 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 - [ ] JUnit - [ ] 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
2023-10-10 12:32:17 +00:00
import type { DataTree } from "entities/DataTree/dataTreeTypes";
chore: send diff updates from worker (#24933) ## Description - Optimisation around evaluation updates to the state - Updates generation logic moved from main thread to worker thread - The diff between previous state and next state is less exacting to limit the number of updates - Logic to compress similar updates to reduce the diff updates sent from worker thread to main thread - Memoisation fixes and some selector optimisation for improved performance. #### PR fixes following issue(s) Fixes #24866 #### 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 - [x] Manual - [x] 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 - [x] My code follows the style guidelines of this project - [x] 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 - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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
2023-08-16 05:34:32 +00:00
import equal from "fast-deep-equal";
import { get, isNumber, isObject, set } from "lodash";
fix: remove moment patches (#28084) ## Description Updates were trying to be added it to invalid moment objects which is not necessary. Earlier when we serialse invalid Moment objects it gets converted to null, made code corrections which it to keep it inline with earlier behaviour. #### PR fixes following issue(s) Fixes #27963 #### Type of change - Bug fix (non-breaking change which fixes an issue) #### How Has This Been Tested? - [x] Manual - [ ] JUnit - [x] 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 - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] 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 - [x] 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
2023-10-18 05:25:17 +00:00
import { isMoment } from "moment";
chore: send serialised updated and using klona/json instead of klona (#27319) ## Description - We are no longer performing JSON.stringify(JSON.parse(value)) to clone, clean up undefined values and serialised bigInt. - We are performing deepClones using klona/json which is much faster and later we perform the serialisation on the diff. - We are sending serialised updated to the main thread and it is parsed on the main thread, this helps in reducing structuredClone cost of sending unserialised objects. - Noticed a reduction of worker thread latency by about 75% and doubled the databound our app can handle. #### PR fixes following issue(s) Fixes #26130 #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing > #### How Has This Been Tested? - [x] Manual - [x] JUnit - [ ] 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 - [x] My code follows the style guidelines of this project - [x] 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 - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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 - [x] 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 - [x] 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
2023-09-26 12:14:20 +00:00
import { EvalErrorTypes } from "utils/DynamicBindingUtils";
chore: send diff updates from worker (#24933) ## Description - Optimisation around evaluation updates to the state - Updates generation logic moved from main thread to worker thread - The diff between previous state and next state is less exacting to limit the number of updates - Logic to compress similar updates to reduce the diff updates sent from worker thread to main thread - Memoisation fixes and some selector optimisation for improved performance. #### PR fixes following issue(s) Fixes #24866 #### 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 - [x] Manual - [x] 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 - [x] My code follows the style guidelines of this project - [x] 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 - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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
2023-08-16 05:34:32 +00:00
export const fn_keys: string = "__fn_keys__";
chore: send diff updates from worker (#24933) ## Description - Optimisation around evaluation updates to the state - Updates generation logic moved from main thread to worker thread - The diff between previous state and next state is less exacting to limit the number of updates - Logic to compress similar updates to reduce the diff updates sent from worker thread to main thread - Memoisation fixes and some selector optimisation for improved performance. #### PR fixes following issue(s) Fixes #24866 #### 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 - [x] Manual - [x] 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 - [x] My code follows the style guidelines of this project - [x] 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 - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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
2023-08-16 05:34:32 +00:00
export interface DiffReferenceState {
kind: "referenceState";
path: any[];
referencePath: string;
}
export type DiffWithReferenceState =
| Diff<DataTree, DataTree>
| DiffReferenceState;
// Finds the first index which is a duplicate value
// Returns -1 if there are no duplicates
// Returns the index of the first duplicate entry it finds
// Note: This "can" fail if the object entries don't have their properties in the
// same order.
export const findDuplicateIndex = (arr: Array<unknown>) => {
const _uniqSet = new Set();
let currSetSize = 0;
for (let i = 0; i < arr.length; i++) {
// JSON.stringify because value can be objects
_uniqSet.add(JSON.stringify(arr[i]));
if (_uniqSet.size > currSetSize) currSetSize = _uniqSet.size;
else return i;
}
return -1;
};
2022-03-22 06:09:28 +00:00
/** Function that count occurrences of a substring in a string;
* @param {String} string The string
* @param {String} subString The sub string to search for
* @param {Boolean} [allowOverlapping] Optional. (Default:false)
* @param {Number | null} [maxLimit] Optional. (Default:null)
*/
export const countOccurrences = (
string: string,
subString: string,
allowOverlapping = false,
maxLimit: number | null = null,
): number => {
string += "";
subString += "";
if (subString.length <= 0) return string.length + 1;
let n = 0, // count of occurrences
pos = 0; // current position of the pointer
const step = allowOverlapping ? 1 : subString.length;
while (true) {
pos = string.indexOf(subString, pos);
if (pos >= 0) {
++n;
/**
* If you are only interested in knowing
* whether occurances count exceeds maxLimit,
* then break the loop.
*/
if (maxLimit && n > maxLimit) break;
pos += step;
} else break;
}
return n;
};
chore: send diff updates from worker (#24933) ## Description - Optimisation around evaluation updates to the state - Updates generation logic moved from main thread to worker thread - The diff between previous state and next state is less exacting to limit the number of updates - Logic to compress similar updates to reduce the diff updates sent from worker thread to main thread - Memoisation fixes and some selector optimisation for improved performance. #### PR fixes following issue(s) Fixes #24866 #### 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 - [x] Manual - [x] 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 - [x] My code follows the style guidelines of this project - [x] 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 - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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
2023-08-16 05:34:32 +00:00
const LARGE_COLLECTION_SIZE = 100;
// for object paths which have a "." in the object key like "a.['b.c']"
const REGEX_NESTED_OBJECT_PATH = /(.+)\.\[\'(.*)\'\]/;
const generateWithKey = (basePath: any, key: any) => {
const segmentedPath = [...basePath, key];
if (isNumber(key)) {
return {
path: basePath.join(".") + ".[" + key + "]",
segmentedPath,
};
}
if (key.includes(".")) {
return {
path: basePath.join(".") + ".['" + key + "']",
segmentedPath,
};
}
return {
path: basePath.join(".") + "." + key,
segmentedPath,
};
};
export const stringifyFnsInObject = (
userObject: Record<string, unknown>,
): Record<string, unknown> => {
const paths: string[] = parseFunctionsInObject(userObject);
const fnStrings: string[] = [];
for (const path of paths) {
const fnValue: any = get(userObject, path);
fnStrings.push(fnValue.toString());
}
const output = JSON.parse(JSON.stringify(userObject));
for (const [index, parsedFnString] of fnStrings.entries()) {
set(output, paths[index], parsedFnString);
}
output[fn_keys] = paths;
return output;
};
const constructPath = (existingPath: string, suffix: string): string => {
if (existingPath.length > 0) {
return `${existingPath}.${suffix}`;
} else {
return suffix;
}
};
const parseFunctionsInObject = (
userObject: Record<string, unknown>,
paths: string[] = [],
path: string = "",
): string[] => {
if (Array.isArray(userObject)) {
for (let i = 0; i < userObject.length; i++) {
const arrayValue = userObject[i];
if (typeof arrayValue == "function") {
paths.push(constructPath(path, `[${i}]`));
} else if (typeof arrayValue == "object") {
parseFunctionsInObject(
arrayValue,
paths,
constructPath(path, `[${i}]`),
);
}
}
} else {
const keys = Object.keys(userObject);
for (const key of keys) {
const value = userObject[key];
if (typeof value == "function") {
paths.push(constructPath(path, key));
} else if (typeof value == "object") {
parseFunctionsInObject(
value as Record<string, unknown>,
paths,
constructPath(path, key),
);
}
}
}
return paths;
};
chore: send diff updates from worker (#24933) ## Description - Optimisation around evaluation updates to the state - Updates generation logic moved from main thread to worker thread - The diff between previous state and next state is less exacting to limit the number of updates - Logic to compress similar updates to reduce the diff updates sent from worker thread to main thread - Memoisation fixes and some selector optimisation for improved performance. #### PR fixes following issue(s) Fixes #24866 #### 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 - [x] Manual - [x] 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 - [x] My code follows the style guidelines of this project - [x] 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 - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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
2023-08-16 05:34:32 +00:00
const isLargeCollection = (val: any) => {
if (!Array.isArray(val)) return false;
const rowSize = !isObject(val[0]) ? 1 : Object.keys(val[0]).length;
const size = val.length * rowSize;
return size > LARGE_COLLECTION_SIZE;
};
const normaliseEvalPath = (identicalEvalPathsPatches: any) =>
Object.keys(identicalEvalPathsPatches || {}).reduce(
(acc: any, evalPath: string) => {
//for object paths which have a "." in the object key like "a.['b.c']", we need to extract these
// paths and break them to appropriate patch paths
const matches = evalPath.match(REGEX_NESTED_OBJECT_PATH);
if (!matches || !matches.length) {
//regular paths like "a.b.c"
acc[evalPath] = identicalEvalPathsPatches[evalPath];
return acc;
}
const [, firstSeg, nestedPathSeg] = matches;
// normalise non nested paths like "a.['b']"
if (!nestedPathSeg.includes(".")) {
const key = [firstSeg, nestedPathSeg].join(".");
acc[key] = identicalEvalPathsPatches[evalPath];
return acc;
}
// object paths which have a "." like "a.['b.c']"
const key = [firstSeg, `['${nestedPathSeg}']`].join(".");
acc[key] = identicalEvalPathsPatches[evalPath];
return acc;
},
{},
);
const generateDiffUpdates = (
oldDataTree: any,
dataTree: any,
ignoreLargeKeys: any,
): DiffWithReferenceState[] => {
const attachDirectly: DiffWithReferenceState[] = [];
const ignoreLargeKeysHasBeenAttached = new Set();
const attachLater: DiffWithReferenceState[] = [];
const updates =
diff(oldDataTree, dataTree, (path, key) => {
if (!path.length || key === "__evaluation__") return false;
const { path: setPath, segmentedPath } = generateWithKey(path, key);
// if ignore path is present...this segment of code generates the data compression patches
if (!!ignoreLargeKeys[setPath]) {
const originalStateVal = get(oldDataTree, segmentedPath);
const correspondingStatePath = ignoreLargeKeys[setPath];
const statePathValue = get(dataTree, correspondingStatePath);
if (!equal(originalStateVal, statePathValue)) {
//reference state patches are a patch that does not have a patch value but it provides a path which contains the same value
//this is helpful in making the payload sent to the main thread small
attachLater.push({
kind: "referenceState",
path: segmentedPath,
referencePath: correspondingStatePath,
});
}
ignoreLargeKeysHasBeenAttached.add(setPath);
return true;
}
const rhs = get(dataTree, segmentedPath);
const lhs = get(oldDataTree, segmentedPath);
chore: serialising moment updates #27963 (#29354) ## Description Serialising moment updates directly, no longer making granular moment object updates. #### PR fixes following issue(s) Fixes #27963 #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing > #### How Has This Been Tested? - [x] Manual - [ ] JUnit - [x] 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 - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] 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 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved error handling in certain scenarios to provide clearer feedback to users. - **New Features** - Enhanced date and time handling to ensure more reliable performance. - **Tests** - Updated automated tests to include additional wait times for better stability and accuracy. - **Documentation** - Comments within the code have been updated to better reflect the current logic for future reference. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2023-12-11 04:29:46 +00:00
//when a moment value changes we do not want the inner moment object updates, we just want the ISO result of it
// which we get during the serialisation process we perform at latter steps
if (isMoment(rhs)) {
attachDirectly.push({
kind: "E",
lhs,
rhs: rhs as any,
path: segmentedPath,
});
// ignore trying to diff moment objects
fix: remove moment patches (#28084) ## Description Updates were trying to be added it to invalid moment objects which is not necessary. Earlier when we serialse invalid Moment objects it gets converted to null, made code corrections which it to keep it inline with earlier behaviour. #### PR fixes following issue(s) Fixes #27963 #### Type of change - Bug fix (non-breaking change which fixes an issue) #### How Has This Been Tested? - [x] Manual - [ ] JUnit - [x] 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 - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] 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 - [x] 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
2023-10-18 05:25:17 +00:00
return true;
}
chore: send serialised updated and using klona/json instead of klona (#27319) ## Description - We are no longer performing JSON.stringify(JSON.parse(value)) to clone, clean up undefined values and serialised bigInt. - We are performing deepClones using klona/json which is much faster and later we perform the serialisation on the diff. - We are sending serialised updated to the main thread and it is parsed on the main thread, this helps in reducing structuredClone cost of sending unserialised objects. - Noticed a reduction of worker thread latency by about 75% and doubled the databound our app can handle. #### PR fixes following issue(s) Fixes #26130 #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing > #### How Has This Been Tested? - [x] Manual - [x] JUnit - [ ] 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 - [x] My code follows the style guidelines of this project - [x] 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 - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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 - [x] 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 - [x] 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
2023-09-26 12:14:20 +00:00
if (rhs === undefined) {
//if an undefined value is being set it should be a delete
if (lhs !== undefined) {
attachDirectly.push({ kind: "D", lhs, path: segmentedPath });
}
// if the lhs is also undefined ignore diff on this node
return true;
}
chore: send diff updates from worker (#24933) ## Description - Optimisation around evaluation updates to the state - Updates generation logic moved from main thread to worker thread - The diff between previous state and next state is less exacting to limit the number of updates - Logic to compress similar updates to reduce the diff updates sent from worker thread to main thread - Memoisation fixes and some selector optimisation for improved performance. #### PR fixes following issue(s) Fixes #24866 #### 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 - [x] Manual - [x] 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 - [x] My code follows the style guidelines of this project - [x] 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 - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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
2023-08-16 05:34:32 +00:00
const isLhsLarge = isLargeCollection(lhs);
const isRhsLarge = isLargeCollection(rhs);
if (!isLhsLarge && !isRhsLarge) {
//perform diff on this node
return false;
}
//if either of values are large just directly attach it don't have to generate very granular updates
if ((!isLhsLarge && isRhsLarge) || (isLhsLarge && !isRhsLarge)) {
attachDirectly.push({ kind: "N", path: segmentedPath, rhs });
return true;
}
//if the values are different attach the update directly
!equal(lhs, rhs) &&
attachDirectly.push({ kind: "N", path: segmentedPath, rhs });
//ignore diff on this node
return true;
}) || [];
chore: diff fixes on evalProps remove sending evaluatedData patches (#31222) ## Description evalprops was no longer being diffed and cloned but the decompress code continued to send evalProps patches. Have removed the logic associated to it. #### PR fixes following issue(s) Fixes #31092 #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing > #### How Has This Been Tested? - [ ] Manual - [ ] JUnit - [ ] Jest - [x] 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 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a mapping of column types to sets of properties to be hidden in the TableWidget, enhancing performance and readability. - **Refactor** - Improved object merging methods in Widget utilities for better efficiency and maintainability. - Updated the `hideByColumnType` function in TableWidget for optimized performance with `Set`. - Streamlined the process for generating updates based on data changes in Evaluation helpers. - **Tests** - Adjusted the ClientSide regression suite to include new test specs and increased delay in HomePage methods for more reliable test execution. - **Chores** - Temporarily disabled certain assertions in test support pages to address test stability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-02-26 04:32:52 +00:00
const largeDataSetUpdates = [...attachDirectly, ...attachLater];
chore: send diff updates from worker (#24933) ## Description - Optimisation around evaluation updates to the state - Updates generation logic moved from main thread to worker thread - The diff between previous state and next state is less exacting to limit the number of updates - Logic to compress similar updates to reduce the diff updates sent from worker thread to main thread - Memoisation fixes and some selector optimisation for improved performance. #### PR fixes following issue(s) Fixes #24866 #### 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 - [x] Manual - [x] 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 - [x] My code follows the style guidelines of this project - [x] 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 - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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
2023-08-16 05:34:32 +00:00
return [...updates, ...largeDataSetUpdates];
};
export const generateOptimisedUpdates = (
oldDataTree: any,
dataTree: any,
identicalEvalPathsPatches?: Record<string, string>,
): DiffWithReferenceState[] => {
const ignoreLargeKeys = normaliseEvalPath(identicalEvalPathsPatches);
const updates = generateDiffUpdates(oldDataTree, dataTree, ignoreLargeKeys);
return updates;
};
chore: send serialised updated and using klona/json instead of klona (#27319) ## Description - We are no longer performing JSON.stringify(JSON.parse(value)) to clone, clean up undefined values and serialised bigInt. - We are performing deepClones using klona/json which is much faster and later we perform the serialisation on the diff. - We are sending serialised updated to the main thread and it is parsed on the main thread, this helps in reducing structuredClone cost of sending unserialised objects. - Noticed a reduction of worker thread latency by about 75% and doubled the databound our app can handle. #### PR fixes following issue(s) Fixes #26130 #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing > #### How Has This Been Tested? - [x] Manual - [x] JUnit - [ ] 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 - [x] My code follows the style guidelines of this project - [x] 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 - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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 - [x] 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 - [x] 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
2023-09-26 12:14:20 +00:00
export const generateSerialisedUpdates = (
prevState: any,
currentState: any,
identicalEvalPathsPatches: any,
): {
serialisedUpdates: string;
error?: { type: string; message: string };
} => {
const updates = generateOptimisedUpdates(
prevState,
currentState,
identicalEvalPathsPatches,
chore: send diff updates from worker (#24933) ## Description - Optimisation around evaluation updates to the state - Updates generation logic moved from main thread to worker thread - The diff between previous state and next state is less exacting to limit the number of updates - Logic to compress similar updates to reduce the diff updates sent from worker thread to main thread - Memoisation fixes and some selector optimisation for improved performance. #### PR fixes following issue(s) Fixes #24866 #### 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 - [x] Manual - [x] 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 - [x] My code follows the style guidelines of this project - [x] 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 - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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
2023-08-16 05:34:32 +00:00
);
chore: send serialised updated and using klona/json instead of klona (#27319) ## Description - We are no longer performing JSON.stringify(JSON.parse(value)) to clone, clean up undefined values and serialised bigInt. - We are performing deepClones using klona/json which is much faster and later we perform the serialisation on the diff. - We are sending serialised updated to the main thread and it is parsed on the main thread, this helps in reducing structuredClone cost of sending unserialised objects. - Noticed a reduction of worker thread latency by about 75% and doubled the databound our app can handle. #### PR fixes following issue(s) Fixes #26130 #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing > #### How Has This Been Tested? - [x] Manual - [x] JUnit - [ ] 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 - [x] My code follows the style guidelines of this project - [x] 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 - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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 - [x] 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 - [x] 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
2023-09-26 12:14:20 +00:00
//remove lhs from diff to reduce the size of diff upload,
//it is not necessary to send lhs and we can make the payload to transfer to the main thread smaller for quicker transfer
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const removedLhs = updates.map(({ lhs, ...rest }: any) => rest);
try {
// serialise bigInt values and convert the updates to a string over here to minismise the cost of transfer
// to the main thread. In the main thread parse this object there.
return { serialisedUpdates: serialiseToBigInt(removedLhs) };
} catch (error) {
return {
serialisedUpdates: "[]",
error: {
type: EvalErrorTypes.SERIALIZATION_ERROR,
message: (error as Error).message,
},
};
}
};
chore: send diff updates from worker (#24933) ## Description - Optimisation around evaluation updates to the state - Updates generation logic moved from main thread to worker thread - The diff between previous state and next state is less exacting to limit the number of updates - Logic to compress similar updates to reduce the diff updates sent from worker thread to main thread - Memoisation fixes and some selector optimisation for improved performance. #### PR fixes following issue(s) Fixes #24866 #### 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 - [x] Manual - [x] 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 - [x] My code follows the style guidelines of this project - [x] 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 - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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
2023-08-16 05:34:32 +00:00
export const generateOptimisedUpdatesAndSetPrevState = (
dataTree: any,
dataTreeEvaluator: any,
) => {
const identicalEvalPathsPatches =
dataTreeEvaluator?.getEvalPathsIdenticalToState();
chore: send serialised updated and using klona/json instead of klona (#27319) ## Description - We are no longer performing JSON.stringify(JSON.parse(value)) to clone, clean up undefined values and serialised bigInt. - We are performing deepClones using klona/json which is much faster and later we perform the serialisation on the diff. - We are sending serialised updated to the main thread and it is parsed on the main thread, this helps in reducing structuredClone cost of sending unserialised objects. - Noticed a reduction of worker thread latency by about 75% and doubled the databound our app can handle. #### PR fixes following issue(s) Fixes #26130 #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing > #### How Has This Been Tested? - [x] Manual - [x] JUnit - [ ] 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 - [x] My code follows the style guidelines of this project - [x] 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 - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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 - [x] 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 - [x] 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
2023-09-26 12:14:20 +00:00
const { error, serialisedUpdates } = generateSerialisedUpdates(
dataTreeEvaluator.getPrevState(),
chore: send diff updates from worker (#24933) ## Description - Optimisation around evaluation updates to the state - Updates generation logic moved from main thread to worker thread - The diff between previous state and next state is less exacting to limit the number of updates - Logic to compress similar updates to reduce the diff updates sent from worker thread to main thread - Memoisation fixes and some selector optimisation for improved performance. #### PR fixes following issue(s) Fixes #24866 #### 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 - [x] Manual - [x] 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 - [x] My code follows the style guidelines of this project - [x] 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 - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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
2023-08-16 05:34:32 +00:00
dataTree,
identicalEvalPathsPatches,
);
chore: send serialised updated and using klona/json instead of klona (#27319) ## Description - We are no longer performing JSON.stringify(JSON.parse(value)) to clone, clean up undefined values and serialised bigInt. - We are performing deepClones using klona/json which is much faster and later we perform the serialisation on the diff. - We are sending serialised updated to the main thread and it is parsed on the main thread, this helps in reducing structuredClone cost of sending unserialised objects. - Noticed a reduction of worker thread latency by about 75% and doubled the databound our app can handle. #### PR fixes following issue(s) Fixes #26130 #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing > #### How Has This Been Tested? - [x] Manual - [x] JUnit - [ ] 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 - [x] My code follows the style guidelines of this project - [x] 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 - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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 - [x] 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 - [x] 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
2023-09-26 12:14:20 +00:00
if (error) {
dataTreeEvaluator.errors.push(error);
}
chore: send diff updates from worker (#24933) ## Description - Optimisation around evaluation updates to the state - Updates generation logic moved from main thread to worker thread - The diff between previous state and next state is less exacting to limit the number of updates - Logic to compress similar updates to reduce the diff updates sent from worker thread to main thread - Memoisation fixes and some selector optimisation for improved performance. #### PR fixes following issue(s) Fixes #24866 #### 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 - [x] Manual - [x] 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 - [x] My code follows the style guidelines of this project - [x] 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 - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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
2023-08-16 05:34:32 +00:00
dataTreeEvaluator?.setPrevState(dataTree);
chore: send serialised updated and using klona/json instead of klona (#27319) ## Description - We are no longer performing JSON.stringify(JSON.parse(value)) to clone, clean up undefined values and serialised bigInt. - We are performing deepClones using klona/json which is much faster and later we perform the serialisation on the diff. - We are sending serialised updated to the main thread and it is parsed on the main thread, this helps in reducing structuredClone cost of sending unserialised objects. - Noticed a reduction of worker thread latency by about 75% and doubled the databound our app can handle. #### PR fixes following issue(s) Fixes #26130 #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing > #### How Has This Been Tested? - [x] Manual - [x] JUnit - [ ] 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 - [x] My code follows the style guidelines of this project - [x] 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 - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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 - [x] 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 - [x] 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
2023-09-26 12:14:20 +00:00
return serialisedUpdates;
chore: send diff updates from worker (#24933) ## Description - Optimisation around evaluation updates to the state - Updates generation logic moved from main thread to worker thread - The diff between previous state and next state is less exacting to limit the number of updates - Logic to compress similar updates to reduce the diff updates sent from worker thread to main thread - Memoisation fixes and some selector optimisation for improved performance. #### PR fixes following issue(s) Fixes #24866 #### 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 - [x] Manual - [x] 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 - [x] My code follows the style guidelines of this project - [x] 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 - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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
2023-08-16 05:34:32 +00:00
};