Skip to content

Commit

Permalink
fix: mirror deletions between control panel and flow chart (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
39bytes authored Dec 19, 2023
1 parent e74c60e commit a5c3fe0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/renderer/src/stores/flowchart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ export const useFlowchartStore = create<FlowchartState>()(
set({
nodes: applyNodeChanges(changes, get().nodes)
});
// Delete corresponding nodes in control canvas
set({
controls: applyNodeChanges(
changes.filter((c) => c.type === 'remove'),
get().controls
)
});
},
onEdgesChange: (changes: EdgeChange[]) => {
set({
Expand All @@ -118,6 +125,13 @@ export const useFlowchartStore = create<FlowchartState>()(
set({
controls: applyNodeChanges(changes, get().controls)
});
// Delete corresponding nodes in flow chart
set({
nodes: applyNodeChanges(
changes.filter((c) => c.type === 'remove'),
get().nodes
)
});
},

onConnect: (connection: Connection) => {
Expand Down

0 comments on commit a5c3fe0

Please sign in to comment.