Spaces:
Running
Running
Really preserve selection.
Browse files
lynxkite-app/web/src/workspace/Workspace.tsx
CHANGED
@@ -81,11 +81,12 @@ function LynxKiteFlow() {
|
|
81 |
n.dragHandle = ".bg-primary";
|
82 |
}
|
83 |
}
|
84 |
-
const
|
85 |
-
const
|
|
|
86 |
selection.includes(n.id) ? { ...n, selected: true } : n,
|
87 |
);
|
88 |
-
setNodes([...
|
89 |
setEdges([...state.workspace.edges] as Edge[]);
|
90 |
for (const node of state.workspace.nodes) {
|
91 |
// Make sure the internal copies are updated.
|
|
|
81 |
n.dragHandle = ".bg-primary";
|
82 |
}
|
83 |
}
|
84 |
+
const nodes = reactFlow.getNodes();
|
85 |
+
const selection = nodes.filter((n) => n.selected).map((n) => n.id);
|
86 |
+
const newNodes = state.workspace.nodes.map((n) =>
|
87 |
selection.includes(n.id) ? { ...n, selected: true } : n,
|
88 |
);
|
89 |
+
setNodes([...newNodes] as Node[]);
|
90 |
setEdges([...state.workspace.edges] as Edge[]);
|
91 |
for (const node of state.workspace.nodes) {
|
92 |
// Make sure the internal copies are updated.
|