Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
simon louvet committed Jun 17, 2024
1 parent 352b202 commit 9a06d42
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions frontend/src/components/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ const Map = () => {
};

const resizeObserver = new ResizeObserver(handleResize);
if (containerRef.current) {
resizeObserver.observe(containerRef.current);
const currentContainerRef = containerRef.current;
if (currentContainerRef) {
resizeObserver.observe(currentContainerRef);
}

return () => {
if (containerRef.current) {
resizeObserver.unobserve(containerRef.current);
if (currentContainerRef) {
resizeObserver.unobserve(currentContainerRef);
}
};
}, [containerWidth]);
Expand Down

0 comments on commit 9a06d42

Please sign in to comment.