Merge branch 'nested-nodes-flat' of github.com:wbkd/react-flow into nested-nodes-flat

This commit is contained in:
Christopher Möller
2021-10-27 12:53:36 +02:00
2 changed files with 13 additions and 11 deletions
+3 -3
View File
@@ -81,14 +81,14 @@ function Node({
const childRect = useMemo(() => getRectOfNodes(childNodes), [childNodes]);
const isParentNode = !!childNodes.length;
node.style = useMemo(() => {
const style = useMemo(() => {
if (isParentNode) {
return {
...node.style,
width: Math.floor(childRect.width) + 20,
height: Math.floor(childRect.height) + 20,
boxSizing: 'border-box',
};
} as React.CSSProperties;
}
return node.style;
}, [childRect.width, childRect.height, isParentNode, node.style]);
@@ -109,7 +109,7 @@ function Node({
<NodeComponent
id={node.id}
className={node.className}
style={node.style}
style={style}
type={nodeType}
data={node.data}
sourcePosition={node.sourcePosition}