handle undefined node in NodeComponentWrapperInner

This commit is contained in:
filippo-one
2026-01-26 15:19:40 +01:00
parent cf2d4be3f5
commit 2db23d9eab

View File

@@ -84,7 +84,10 @@ function NodeComponentWrapperInner<NodeType extends Node>({
shapeRendering: string; shapeRendering: string;
}) { }) {
const { node, x, y, width, height } = useStore((s) => { const { node, x, y, width, height } = useStore((s) => {
const { internals } = s.nodeLookup.get(id)!; const internals = s.nodeLookup.get(id)?.internals;
if (!internals) {
return { node: undefined, x: 0, y: 0, width: 0, height: 0 };
}
const node = internals.userNode as NodeType; const node = internals.userNode as NodeType;
const { x, y } = internals.positionAbsolute; const { x, y } = internals.positionAbsolute;
const { width, height } = getNodeDimensions(node); const { width, height } = getNodeDimensions(node);