refactor(internals): make prop optional

This commit is contained in:
moklick
2022-05-26 20:57:12 +02:00
parent ee7084b5dc
commit 2ed3ffe818
8 changed files with 30 additions and 14 deletions
+1 -1
View File
@@ -168,7 +168,7 @@ export function isEdgeVisible({
export function getNodeData(nodeInternals: NodeInternals, nodeId: string): [Rect, NodeHandleBounds | null, boolean] {
const node = nodeInternals.get(nodeId);
const handleBounds = node?.[internalsSymbol].handleBounds || null;
const handleBounds = node?.[internalsSymbol]?.handleBounds || null;
const isInvalid =
!node ||
+2 -2
View File
@@ -118,8 +118,8 @@ const NodeRenderer = (props: NodeRendererProps) => {
isConnectable={isConnectable}
resizeObserver={resizeObserver}
dragHandle={node.dragHandle}
zIndex={node[internalsSymbol].z ?? 0}
isParent={!!node[internalsSymbol].isParent}
zIndex={node[internalsSymbol]?.z ?? 0}
isParent={!!node[internalsSymbol]?.isParent}
noDragClassName={props.noDragClassName}
noPanClassName={props.noPanClassName}
/>