From e0714d1a089f951042364780d705ca89faaff8c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matuzal=C3=A9m=20Teles?= Date: Wed, 1 Nov 2023 13:46:25 -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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/clay-core/src/collection/useCollection.tsx b/packages/clay-core/src/collection/useCollection.tsx index 79acbb6a74..83d1fee5f9 100644 --- a/packages/clay-core/src/collection/useCollection.tsx +++ b/packages/clay-core/src/collection/useCollection.tsx @@ -414,9 +414,9 @@ export function useCollection< // there are nested collections. useEffect( () => () => { - cleanUp(); - if (forceUpdate) { + cleanUp(); + forceUpdate(null); } },