refactor(nodes): simplify selection handling

This commit is contained in:
moklick
2022-05-22 14:09:40 +02:00
parent 21f56db09a
commit a88e53ddc5
9 changed files with 95 additions and 75 deletions
+1 -2
View File
@@ -45,8 +45,7 @@ function handleParentExpand(res: any[], updateItem: any) {
}
function applyChanges(changes: any[], elements: any[]): any[] {
// unfortunately we need this hack to handle the setNodes and setEdges function of the
// useReactFlow hook.
// we need this hack to handle the setNodes and setEdges function of the useReactFlow hook for controlled flows
if (changes.some((c) => c.type === 'reset')) {
return changes.filter((c) => c.type === 'reset').map((c) => c.item);
}