From e8d26002a11103fad7f2be28743ff0178d75d548 Mon Sep 17 00:00:00 2001 From: moklick Date: Mon, 25 Oct 2021 16:56:54 +0200 Subject: [PATCH] refactor(node-renderer): do not mutate node styles --- src/container/NodeRenderer/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/container/NodeRenderer/index.tsx b/src/container/NodeRenderer/index.tsx index 002b015a..40ebb906 100644 --- a/src/container/NodeRenderer/index.tsx +++ b/src/container/NodeRenderer/index.tsx @@ -83,14 +83,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]); @@ -111,7 +111,7 @@ function Node({