Skip to content

Commit

Permalink
remove unevalTree
Browse files Browse the repository at this point in the history
  • Loading branch information
vsvamsi1 committed Jul 5, 2024
1 parent 3771508 commit 73e226d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 30 deletions.
6 changes: 2 additions & 4 deletions app/client/src/sagas/EvalWorkerActionSagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ import {
import { handleStoreOperations } from "./ActionExecution/StoreActionSaga";
import type { EvalTreeResponseData } from "workers/Evaluation/types";
import isEmpty from "lodash/isEmpty";
import type { UnEvalTree } from "entities/DataTree/dataTreeTypes";
import { sortJSExecutionDataByCollectionId } from "workers/Evaluation/JSObject/utils";
import type { LintTreeSagaRequestData } from "plugins/Linting/types";
import { evalErrorHandler } from "./EvalErrorHandler";
import { getUnevaluatedDataTree } from "selectors/dataTreeSelectors";

export interface UpdateDataTreeMessageData {
workerResponse: EvalTreeResponseData;
unevalTree: UnEvalTree;
}

export function* handleEvalWorkerRequestSaga(listenerChannel: Channel<any>) {
Expand Down Expand Up @@ -141,12 +139,12 @@ export function* handleEvalWorkerMessage(message: TMessage<any>) {
break;
}
case MAIN_THREAD_ACTION.UPDATE_DATATREE: {
const { unevalTree, workerResponse } = data as UpdateDataTreeMessageData;
const { workerResponse } = data as UpdateDataTreeMessageData;
const unEvalAndConfigTree: ReturnType<typeof getUnevaluatedDataTree> =
yield select(getUnevaluatedDataTree);
yield call(updateDataTreeHandler, {
evalTreeResponse: workerResponse as EvalTreeResponseData,
unevalTree,
unevalTree: unEvalAndConfigTree.unEvalTree || {},
requiresLogging: false,
configTree: unEvalAndConfigTree.configTree,
});
Expand Down
23 changes: 0 additions & 23 deletions app/client/src/workers/Evaluation/evalTreeWithChanges.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ describe("evaluateAndGenerateResponse", () => {

expect(parsedUpdates).toEqual([]);
expect(webworkerResponse).toEqual({
unevalTree: {},
workerResponse: {
dependencies: {},
errors: [],
Expand Down Expand Up @@ -224,28 +223,6 @@ describe("evaluateAndGenerateResponse", () => {

expect(parsedUpdates).toEqual([]);
});
test("should send the new unevalTree in the web worker response", () => {
const updatedLabelUnevalTree = produce(unEvalTree, (draft: any) => {
if (draft.Text1?.text) {
draft.Text1.text = UPDATED_LABEL;
}
});
expect(evaluator.getOldUnevalTree()).toEqual(unEvalTree);
const updateTreeResponse = evaluator.setupUpdateTree(
updatedLabelUnevalTree,
configTree,
);
// the new unevalTree gets set in setupUpdateTree
expect(evaluator.getOldUnevalTree()).toEqual(updatedLabelUnevalTree);

const { unevalTree } = evalTreeWithChanges.evaluateAndGenerateResponse(
evaluator,
updateTreeResponse,
[],
[],
);
expect(unevalTree).toEqual(updatedLabelUnevalTree);
});

describe("updates", () => {
test("should generate updates based on the unEvalUpdates", () => {
Expand Down
3 changes: 0 additions & 3 deletions app/client/src/workers/Evaluation/evalTreeWithChanges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ export const evaluateAndGenerateResponse = (
defaultResponse.evalMetaUpdates = [...(metaUpdates || [])];
return {
workerResponse: defaultResponse,
unevalTree: {},
};
}

Expand Down Expand Up @@ -134,7 +133,6 @@ export const evaluateAndGenerateResponse = (
);

defaultResponse.staleMetaIds = updateResponse.staleMetaIds;
const unevalTree = dataTreeEvaluator.getOldUnevalTree();

// when additional paths are required to be added as updates, we extract the updates from the data tree using these paths.
const additionalUpdates = getNewDataTreeUpdates(
Expand All @@ -159,7 +157,6 @@ export const evaluateAndGenerateResponse = (

return {
workerResponse: defaultResponse,
unevalTree,
};
};

Expand Down

0 comments on commit 73e226d

Please sign in to comment.