Skip to content

Commit

Permalink
fix: store copy of workflow in workflowsById to prevent node data bugs (
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgrozav authored Nov 17, 2022
1 parent dea67ca commit 9cadaea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
6 changes: 5 additions & 1 deletion packages/editor-ui/src/stores/workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
} from "@/Interface";
import {defineStore} from "pinia";
import {
deepCopy,
IConnection,
IConnections,
IDataObject,
Expand Down Expand Up @@ -334,7 +335,10 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
},

addWorkflow(workflow: IWorkflowDb) : void {
Vue.set(this.workflowsById, workflow.id, workflow);
Vue.set(this.workflowsById, workflow.id, {
...this.workflowsById[workflow.id],
...deepCopy(workflow),
});
},

setWorkflowActive(workflowId: string): void {
Expand Down
15 changes: 1 addition & 14 deletions packages/editor-ui/src/views/NodeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -834,27 +834,14 @@ export default mixins(
);
}
this.workflowsStore.addWorkflow(data);
this.workflowsStore.setActive(data.active || false);
this.workflowsStore.setWorkflowId(workflowId);
this.workflowsStore.setWorkflowName({ newName: data.name, setStateDirty: false });
this.workflowsStore.setWorkflowSettings(data.settings || {});
this.workflowsStore.setWorkflowPinData(data.pinData || {});
this.workflowsStore.setWorkflowHash(data.hash);
this.workflowsStore.addWorkflow({
id: data.id,
name: data.name,
ownedBy: data.ownedBy,
sharedWith: data.sharedWith,
tags: data.tags || [],
active: data.active,
createdAt: data.createdAt,
updatedAt: data.updatedAt,
nodes: data.nodes,
connections: data.connections,
hash: '',
});
if (data.ownedBy) {
this.workflowsEEStore.setWorkflowOwnedBy({
workflowId: data.id,
Expand Down

0 comments on commit 9cadaea

Please sign in to comment.