Skip to content

Commit

Permalink
resolve pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dvj1988 committed Dec 11, 2024
1 parent 6203160 commit 5c933fb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
3 changes: 0 additions & 3 deletions app/client/src/sagas/EvaluationsSaga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ import {
getCurrentPageId,
} from "selectors/editorSelectors";
import { getInstanceId } from "ee/selectors/tenantSelectors";
import { waitForFetchEnvironments } from "ee/sagas/EnvironmentSagas";

const APPSMITH_CONFIGS = getAppsmithConfigs();

Expand Down Expand Up @@ -294,8 +293,6 @@ export function* evaluateTreeSaga(
evalTreeRequestData,
);

yield call(waitForFetchEnvironments);

yield call(
updateDataTreeHandler,
{
Expand Down
4 changes: 4 additions & 0 deletions app/client/src/sagas/PostEvaluationSagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import type { EvalTreeResponseData } from "workers/Evaluation/types";
import { endSpan, startRootSpan } from "UITelemetry/generateTraces";
import { getCollectionNameToDisplay } from "ee/utils/actionExecutionUtils";
import { showToastOnExecutionError } from "./ActionExecution/errorUtils";
import { waitForFetchEnvironments } from "ee/sagas/EnvironmentSagas";

let successfulBindingsMap: SuccessfulBindingMap | undefined;

Expand Down Expand Up @@ -190,6 +191,9 @@ export function* logSuccessfulBindings(
}

export function* postEvalActionDispatcher(actions: Array<AnyReduxAction>) {
// Wait for environments api fetch before dispatching actions
yield call(waitForFetchEnvironments);

for (const action of actions) {
yield put(action);
}
Expand Down
6 changes: 3 additions & 3 deletions app/client/src/workers/Evaluation/evaluate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ export function evaluateSync(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
evalArguments?: Array<any>,
configTree: ConfigTree = {},
scopeCache?: EvalContext,
evalContextCache?: EvalContext,
): EvalResult {
return (function () {
const errors: EvaluationError[] = [];
Expand Down Expand Up @@ -408,8 +408,8 @@ export function evaluateSync(
Object.assign(EVAL_CONTEXT, context.globalContext);
}

if (scopeCache) {
Object.assign(EVAL_CONTEXT, scopeCache);
if (evalContextCache) {
Object.assign(EVAL_CONTEXT, evalContextCache);
} else {
const dataTreeContext = getDataTreeContext({
dataTree,
Expand Down
16 changes: 8 additions & 8 deletions app/client/src/workers/common/DataTreeEvaluator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1159,13 +1159,13 @@ export default class DataTreeEvaluator {
unEvalPropertyValue = replaceThisDotParams(unEvalPropertyValue);
}

let scopeCache;
let evalContextCache;

if (WorkerEnv.flags.release_evaluation_scope_cache) {
if (!!entity && isAnyJSAction(entity)) {
scopeCache = triggerBasedDataTreeContext;
evalContextCache = triggerBasedDataTreeContext;
} else {
scopeCache = nonTriggerBasedDataTreeContext;
evalContextCache = nonTriggerBasedDataTreeContext;
}
}

Expand All @@ -1178,7 +1178,7 @@ export default class DataTreeEvaluator {
contextData,
undefined,
fullPropertyPath,
scopeCache,
evalContextCache,
);
} catch (error) {
this.errors.push({
Expand Down Expand Up @@ -1506,7 +1506,7 @@ export default class DataTreeEvaluator {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
callBackData?: Array<any>,
fullPropertyPath?: string,
scopeCache?: EvaluateContext,
evalContextCache?: EvaluateContext,
) {
// Get the {{binding}} bound values
let entity: DataTreeEntity | undefined = undefined;
Expand Down Expand Up @@ -1557,7 +1557,7 @@ export default class DataTreeEvaluator {
!!entity && isAnyJSAction(entity),
contextData,
callBackData,
scopeCache,
evalContextCache,
);

if (fullPropertyPath && evalErrors.length) {
Expand Down Expand Up @@ -1651,7 +1651,7 @@ export default class DataTreeEvaluator {
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
callbackData?: Array<any>,
scopeCache?: EvaluateContext,
evalContextCache?: EvaluateContext,
): EvalResult {
let evalResponse: EvalResult;

Expand All @@ -1667,7 +1667,7 @@ export default class DataTreeEvaluator {
contextData,
callbackData,
{},
scopeCache,
evalContextCache,
);
} catch (error) {
evalResponse = {
Expand Down

0 comments on commit 5c933fb

Please sign in to comment.