Fixed rerendering of edges & simplified rerendering of nodes

This commit is contained in:
peterkogo
2024-12-12 12:11:07 +01:00
parent 24735aa003
commit 9105d22c46
6 changed files with 31 additions and 24 deletions
@@ -45,7 +45,11 @@
initialHeight,
width,
height,
dragHandle
dragHandle,
internals: {
z: zIndex = 0,
positionAbsolute: { x: positionX, y: positionY }
}
} = $derived(node);
let { id } = node;
@@ -55,19 +59,6 @@
let connectable = $derived(_connectable ?? store.nodesConnectable);
let initialized = $derived(nodeHasDimensions(node));
// we also pass store.nodes to this function to rerender when a node changes
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function getInternalNode(node: Node, nodes: Node[]) {
return { ...store.nodeLookup.get(node.id)! };
}
let {
internals: {
z: zIndex = 0,
positionAbsolute: { x: positionX, y: positionY }
}
} = $derived(getInternalNode(node, store.nodes));
function isInParentLookup(id: string) {
return store.parentLookup.has(id);
}