From 58f5ae94b63b144f867ae65e3e2784db77db17c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matuzal=C3=A9m=20Teles?= Date: Tue, 31 Oct 2023 19:27:02 -0500 Subject: [PATCH] fix(@clayui/core): fixes error when cleaning up the collection for explicitly 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. --- packages/clay-core/src/collection/useCollection.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/clay-core/src/collection/useCollection.tsx b/packages/clay-core/src/collection/useCollection.tsx index 79acbb6a74..0318014041 100644 --- a/packages/clay-core/src/collection/useCollection.tsx +++ b/packages/clay-core/src/collection/useCollection.tsx @@ -414,9 +414,10 @@ export function useCollection< // there are nested collections. useEffect( () => () => { - cleanUp(); if (forceUpdate) { + cleanUp(); + forceUpdate(null); } },