Skip to content

Commit

Permalink
🐛 feat: add deselect befor deleteSelection
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangchu committed Jan 16, 2024
1 parent ea1690c commit d60431d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/FlowEditor/store/slices/generalActionSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ export const generalActionSlice: StateCreator<
},

deleteSelection: () => {
const { selectedKeys, flattenEdges, flattenNodes, dispatchNodes, dispatchEdges } = get();
console.log(get());

const { selectedKeys, flattenEdges, flattenNodes, dispatchNodes, dispatchEdges, deselectAll } =
get();
deselectAll();
selectedKeys.forEach((id) => {
if (flattenNodes[id]) dispatchNodes({ type: 'deleteNode', id });
if (flattenEdges[id]) dispatchEdges({ type: 'deleteEdge', id });
Expand Down

0 comments on commit d60431d

Please sign in to comment.