Skip to content

Commit

Permalink
fix: Add check for ResizeObserver availability to prevent reference e…
Browse files Browse the repository at this point in the history
…rrors (#455)
  • Loading branch information
ryo-manba committed Feb 26, 2024
1 parent 7df9ad7 commit acecc35
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/mini-map/use-resize.hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ export const useResize = <T extends HTMLElement>(

useLayoutEffect(() => {
didUnmount.current = false;

if (!("ResizeObserver" in window)) {
return;
}

if (ref) {
resizeObserverRef.current = new ResizeObserver(
(entries: ResizeObserverEntry[]) => {
Expand Down

0 comments on commit acecc35

Please sign in to comment.