Skip to content

Commit bcb96a8

Browse files
authored
fix: Breadcrumbs improvements (#654)
1 parent 01f01a8 commit bcb96a8

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/components/Breadcrumbs.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,11 @@ export function DynamicBreadcrumbs({
341341

342342
const refitCrumbList = useCallback(
343343
({ width: wrapperWidth }: { width: number }) => {
344-
const lists = Array.from(
345-
wrapperRef?.current?.querySelectorAll(`[${CRUMB_LIST_ATTR}]`)
346-
)
344+
const lists = wrapperRef?.current
345+
? Array.from(
346+
wrapperRef.current.querySelectorAll(`[${CRUMB_LIST_ATTR}]`)
347+
)
348+
: []
347349
const { id } = lists.reduce(
348350
(prev, next) => {
349351
const prevWidth = prev.width

src/hooks/useResizeObserver.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const useResizeObserver = (
3333
RO.observe(ref.current)
3434

3535
return () => {
36-
RO.disconnect()
36+
RO?.disconnect()
3737
RO = null
3838
}
3939
}, [ref, handleResize])

0 commit comments

Comments
 (0)