-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
33 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
app/client/src/workers/Evaluation/handlers/updateActionsToEvalTree.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import type { DataTree } from "entities/DataTree/dataTreeTypes"; | ||
import { set } from "lodash"; | ||
import DataStore from "../dataStore"; | ||
import type { UpdateActionProps } from "./updateActionData"; | ||
|
||
export function updateActionsToEvalTree( | ||
evalTree: DataTree, | ||
actionsToUpdate?: UpdateActionProps[], | ||
) { | ||
if (!actionsToUpdate) return; | ||
|
||
for (const actionToUpdate of actionsToUpdate) { | ||
const { dataPath, dataPathRef, entityName } = actionToUpdate; | ||
let { data } = actionToUpdate; | ||
|
||
if (dataPathRef) { | ||
data = DataStore.getActionData(dataPathRef); | ||
DataStore.deleteActionData(dataPathRef); | ||
} | ||
|
||
// update the evaltree | ||
set(evalTree, `${entityName}.[${dataPath}]`, data); | ||
// Update context | ||
set(self, `${entityName}.[${dataPath}]`, data); | ||
// Update the datastore | ||
const path = `${entityName}.${dataPath}`; | ||
|
||
DataStore.setActionData(path, data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters