Skip to content

Commit a3dff2d

Browse files
committed
refactor: always call updateRect synchronously in setCarouselRef
1 parent f9ec4e1 commit a3dff2d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/Zoom.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ export default function Zoom({ children }: PropsWithChildren) {
110110

111111
const updateRect = () => setRect(node ? { width: node.clientWidth, height: node.clientHeight } : undefined);
112112

113+
updateRect();
114+
113115
if (node && typeof ResizeObserver !== "undefined") {
114116
observer.current = new ResizeObserver(updateRect);
115117
observer.current.observe(node);
116-
} else {
117-
updateRect();
118118
}
119119
}, []);
120120

0 commit comments

Comments
 (0)