refactor: moved delete logic out of the toolbar declaration and into the FlowStore.
BREAKING: changed type of FlowState ref: N25B-114
This commit is contained in:
@@ -93,6 +93,12 @@ const useFlowStore = create<FlowState>((set, get) => ({
|
||||
edgeReconnectSuccessful: true
|
||||
});
|
||||
},
|
||||
deleteNode: (nodeId: string) => {
|
||||
set({
|
||||
nodes: get().nodes.filter((n) => n.id !== nodeId),
|
||||
edges: get().edges.filter((e) => e.source !== nodeId && e.target !== nodeId)
|
||||
});
|
||||
},
|
||||
setNodes: (nodes) => {
|
||||
set({nodes});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user