From c0cfa40c07ef7c9f73be74ce77a9121f2f0fbd39 Mon Sep 17 00:00:00 2001 From: Marcin Maciaszczyk Date: Tue, 8 Oct 2024 14:10:06 +0200 Subject: [PATCH 1/2] add null check to resize observer disconnect call --- src/hooks/useResizeObserver.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/useResizeObserver.ts b/src/hooks/useResizeObserver.ts index bd194300..574eb6cf 100644 --- a/src/hooks/useResizeObserver.ts +++ b/src/hooks/useResizeObserver.ts @@ -33,7 +33,7 @@ const useResizeObserver = ( RO.observe(ref.current) return () => { - RO.disconnect() + RO?.disconnect() RO = null } }, [ref, handleResize]) From 78d930c585edb6c8902cac1827f12c3c4138d05c Mon Sep 17 00:00:00 2001 From: Marcin Maciaszczyk Date: Tue, 8 Oct 2024 14:16:58 +0200 Subject: [PATCH 2/2] fix array from issue --- src/components/Breadcrumbs.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/Breadcrumbs.tsx b/src/components/Breadcrumbs.tsx index 421587c6..3eb37779 100644 --- a/src/components/Breadcrumbs.tsx +++ b/src/components/Breadcrumbs.tsx @@ -341,9 +341,11 @@ export function DynamicBreadcrumbs({ const refitCrumbList = useCallback( ({ width: wrapperWidth }: { width: number }) => { - const lists = Array.from( - wrapperRef?.current?.querySelectorAll(`[${CRUMB_LIST_ATTR}]`) - ) + const lists = wrapperRef?.current + ? Array.from( + wrapperRef.current.querySelectorAll(`[${CRUMB_LIST_ATTR}]`) + ) + : [] const { id } = lists.reduce( (prev, next) => { const prevWidth = prev.width