Skip to content

Commit 16081b3

Browse files
committed
perf: memoize TreeItem
1 parent d0b7275 commit 16081b3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libs/react/src/components/context-tree.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const ContextTree: FC<{
1818
const TreeItem: FC<{
1919
node: IContextNode
2020
component: React.FC<{ context: IContextNode; insPoints: InsertionPointWithElement[] }>
21-
}> = ({ node, component: Component }) => {
21+
}> = React.memo(({ node, component: Component }) => {
2222
const [wrappedNode, setWrappedNode] = useState({ node })
2323
const [insPoints, setInsPoints] = useState([...node.insPoints])
2424
const [children, setChildren] = useState([...node.children])
@@ -73,4 +73,4 @@ const TreeItem: FC<{
7373
))}
7474
</>
7575
)
76-
}
76+
})

0 commit comments

Comments
 (0)