From f4d92779500c852b56467bfc57e4b43eb2a6f9fa Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Fri, 23 Oct 2020 23:32:59 +0530 Subject: [PATCH] Fix this (#1379) --- app/client/src/constants/ReduxActionConstants.tsx | 1 + app/client/src/sagas/InitSagas.ts | 2 ++ app/client/src/sagas/evaluationsSaga.ts | 13 +++---------- app/client/src/workers/evaluation.worker.ts | 3 ++- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/app/client/src/constants/ReduxActionConstants.tsx b/app/client/src/constants/ReduxActionConstants.tsx index 42e07e3bf9..30e6b55eec 100644 --- a/app/client/src/constants/ReduxActionConstants.tsx +++ b/app/client/src/constants/ReduxActionConstants.tsx @@ -287,6 +287,7 @@ export const ReduxActionTypes: { [key: string]: string } = { WIDGET_ADD_CHILDREN: "WIDGET_ADD_CHILDREN", SET_EVALUATED_TREE: "SET_EVALUATED_TREE", BATCH_UPDATES_SUCCESS: "BATCH_UPDATES_SUCCESS", + START_EVALUATION: "START_EVALUATION", }; export type ReduxActionType = typeof ReduxActionTypes[keyof typeof ReduxActionTypes]; diff --git a/app/client/src/sagas/InitSagas.ts b/app/client/src/sagas/InitSagas.ts index 05987e0b1e..639efc74ca 100644 --- a/app/client/src/sagas/InitSagas.ts +++ b/app/client/src/sagas/InitSagas.ts @@ -45,6 +45,7 @@ function* initializeEditorSaga( initializeEditorAction: ReduxAction, ) { const { applicationId, pageId } = initializeEditorAction.payload; + yield put({ type: ReduxActionTypes.START_EVALUATION }); // Step 1: Start getting all the data needed by the yield all([ put(fetchPageList(applicationId)), @@ -151,6 +152,7 @@ export function* initializeAppViewerSaga( action: ReduxAction<{ applicationId: string }>, ) { const { applicationId } = action.payload; + yield put({ type: ReduxActionTypes.START_EVALUATION }); yield all([ put(fetchActionsForView(applicationId)), put(fetchPageList(applicationId)), diff --git a/app/client/src/sagas/evaluationsSaga.ts b/app/client/src/sagas/evaluationsSaga.ts index 762c5121ec..1d075a431e 100644 --- a/app/client/src/sagas/evaluationsSaga.ts +++ b/app/client/src/sagas/evaluationsSaga.ts @@ -80,10 +80,10 @@ function* evaluateTreeSaga() { export function* evaluateSingleValue(binding: string) { if (evaluationWorker) { - const evalTree = yield select(getDataTree); + const unEvalTree = yield select(getUnevaluatedDataTree); evaluationWorker.postMessage({ action: EVAL_WORKER_ACTIONS.EVAL_SINGLE, - dataTree: evalTree, + dataTree: unEvalTree, binding, }); const workerResponse = yield take(workerChannel); @@ -215,13 +215,6 @@ function* evaluationChangeListenerSaga() { export default function* evaluationSagaListeners() { yield all([ - takeLatest( - ReduxActionTypes.INITIALIZE_EDITOR_SUCCESS, - evaluationChangeListenerSaga, - ), - takeLatest( - ReduxActionTypes.INITIALIZE_PAGE_VIEWER_SUCCESS, - evaluationChangeListenerSaga, - ), + takeLatest(ReduxActionTypes.START_EVALUATION, evaluationChangeListenerSaga), ]); } diff --git a/app/client/src/workers/evaluation.worker.ts b/app/client/src/workers/evaluation.worker.ts index 9e200fdb76..e8b377fbb9 100644 --- a/app/client/src/workers/evaluation.worker.ts +++ b/app/client/src/workers/evaluation.worker.ts @@ -63,7 +63,8 @@ ctx.addEventListener("message", e => { } case EVAL_WORKER_ACTIONS.EVAL_SINGLE: { const { binding, dataTree } = rest; - const withFunctions = addFunctions(dataTree); + const evalTree = getEvaluatedDataTree(dataTree); + const withFunctions = addFunctions(evalTree); const value = getDynamicValue(binding, withFunctions, false); ctx.postMessage({ value, errors: ERRORS }); ERRORS = [];