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 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])