Skip to content

Commit

Permalink
fix(@clayui/core): fixes error when cleaning up the collection for ex…
Browse files Browse the repository at this point in the history
…plicitly nested collections

The clean up should only be done in use cases where we have the collection implicitly declared as the VerticalNav component and the list is rendered in render time instead of just once in the root of the component like the Picker component.
  • Loading branch information
matuzalemsteles committed Nov 1, 2023
1 parent 0463820 commit 58f5ae9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/clay-core/src/collection/useCollection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,10 @@ export function useCollection<
// there are nested collections.
useEffect(
() => () => {
cleanUp();

if (forceUpdate) {
cleanUp();

forceUpdate(null);
}
},
Expand Down

0 comments on commit 58f5ae9

Please sign in to comment.