chore: Capture telemetry around diff and serialise operation (#32124)
## Description Capture telemetry around compute diff between old and new states, also capture the serialise cost of the updates. Fixes #32123 ## Automation /ok-to-test tags="@tag.All" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!IMPORTANT] > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/8456623922> > Commit: `9c1be427190586b155ff5daecfe190f743bacc63` > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=8456623922&attempt=3" target="_blank">Click here!</a> > All cypress tests have passed 🎉🎉🎉 <!-- end of auto-generated comment: Cypress test results --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Improved and optimized update generation logic in the evaluation process. - Enhanced handling of undefined values, function properties, and serialization errors, including `BigInt` and `moment` objects. - Ensured more consistent handling of `moment` objects during updates. - **Tests** - Added and modified tests to cover new scenarios in update generation and data manipulation, including handling of `EvaluationError`. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
783a9e2fa9
commit
6c58b40d0e
|
|
@ -239,32 +239,40 @@ export function evalTree(request: EvalWorkerSyncRequest) {
|
|||
|
||||
const jsVarsCreatedEvent = getJSVariableCreatedEvents(jsUpdates);
|
||||
|
||||
let updates;
|
||||
if (isNewTree) {
|
||||
try {
|
||||
//for new tree send the whole thing, don't diff at all
|
||||
updates = serialiseToBigInt([{ kind: "newTree", rhs: dataTree }]);
|
||||
dataTreeEvaluator?.setPrevState(dataTree);
|
||||
} catch (e) {
|
||||
updates = "[]";
|
||||
}
|
||||
isNewTree = false;
|
||||
} else {
|
||||
const allUnevalUpdates = unEvalUpdates.map(
|
||||
(update) => update.payload.propertyPath,
|
||||
);
|
||||
const updates = profileFn(
|
||||
"diffAndGenerateSerializeUpdates",
|
||||
undefined,
|
||||
webworkerTelemetry,
|
||||
() => {
|
||||
let updates;
|
||||
if (isNewTree) {
|
||||
try {
|
||||
//for new tree send the whole thing, don't diff at all
|
||||
updates = serialiseToBigInt([{ kind: "newTree", rhs: dataTree }]);
|
||||
dataTreeEvaluator?.setPrevState(dataTree);
|
||||
} catch (e) {
|
||||
updates = "[]";
|
||||
}
|
||||
isNewTree = false;
|
||||
} else {
|
||||
const allUnevalUpdates = unEvalUpdates.map(
|
||||
(update) => update.payload.propertyPath,
|
||||
);
|
||||
|
||||
const completeEvalOrder = uniqueOrderUpdatePaths([
|
||||
...allUnevalUpdates,
|
||||
...evalOrder,
|
||||
]);
|
||||
const completeEvalOrder = uniqueOrderUpdatePaths([
|
||||
...allUnevalUpdates,
|
||||
...evalOrder,
|
||||
]);
|
||||
|
||||
updates = generateOptimisedUpdatesAndSetPrevState(
|
||||
dataTree,
|
||||
dataTreeEvaluator,
|
||||
completeEvalOrder,
|
||||
);
|
||||
}
|
||||
updates = generateOptimisedUpdatesAndSetPrevState(
|
||||
dataTree,
|
||||
dataTreeEvaluator,
|
||||
completeEvalOrder,
|
||||
);
|
||||
}
|
||||
return updates;
|
||||
},
|
||||
);
|
||||
|
||||
const evalTreeResponse: EvalTreeResponseData = {
|
||||
updates,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user