Skip to content

Commit

Permalink
batching buffered and evalTrigger
Browse files Browse the repository at this point in the history
  • Loading branch information
vsvamsi1 committed Dec 17, 2024
1 parent 361b4f5 commit 0bcb2a6
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions app/client/src/sagas/EvaluationsSaga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import {
import type { JSAction, JSCollection } from "entities/JSCollection";
import { getAppMode } from "ee/selectors/applicationSelectors";
import { APP_MODE } from "entities/App";
import { get, isEmpty } from "lodash";
import { get, isEmpty, isEqual } from "lodash";
import type { TriggerMeta } from "ee/sagas/ActionExecution/ActionExecutionSagas";
import { executeActionTriggers } from "ee/sagas/ActionExecution/ActionExecutionSagas";
import {
Expand Down Expand Up @@ -762,17 +762,18 @@ function* evaluationChangeListenerSaga(): any {
timeout: delay(1000),
});

if (action?.type === ReduxActionTypes.TRIGGER_EVAL) {
if (
action?.type === ReduxActionTypes.TRIGGER_EVAL ||
isEqual(action, bufferedAction)
) {
hasTriggerAction = true;
continue;
}

if (timeout) {
if (hasTriggerAction) {
const action = {
type: ReduxActionTypes.TRIGGER_EVAL,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const action = bufferedAction as any;
const affectedJSObjects = getAffectedJSObjectIdsFromAction(action);

yield call(evalAndLintingHandler, true, action, {
Expand All @@ -799,6 +800,15 @@ function* evaluationChangeListenerSaga(): any {
}
}

const bufferedAction = {
postEvalActions: [],
affectedJSObjects: {
isAllAffected: false,
ids: [],
},
type: "BUFFERED_ACTION",
};

// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function* evaluateActionSelectorFieldSaga(action: any) {
Expand Down

0 comments on commit 0bcb2a6

Please sign in to comment.