Skip to content

Commit 3243fc8

Browse files
committed
fix(react-arborist/provider): There is a bug in using the tree.update method to set height.
re #228
1 parent c52f672 commit 3243fc8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/react-arborist/src/components/provider.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ export function TreeProvider<T>({
5757
useMemo(() => {
5858
updateCount.current += 1;
5959
api.update(treeProps);
60-
}, [...Object.values(treeProps), state.nodes.open]);
60+
}, [...Object.values(treeProps)]);
61+
62+
/* when the node's open or closed state changes, just perform rendering. */
63+
useMemo(() => {
64+
api.update(api.props);
65+
}, [state.nodes.open]);
6166

6267
/* Expose the tree api */
6368
useImperativeHandle(imperativeHandle, () => api);

0 commit comments

Comments
 (0)