mirror of
https://github.com/rive-app/rive-react.git
synced 2026-03-13 08:22:30 +08:00
fix recursive useEffect call
This commit is contained in:
committed by
Zachary Plata
parent
2c82fa04e7
commit
33760042d1
@@ -62,6 +62,8 @@ export default function useResizeCanvas({
|
||||
);
|
||||
const currentDevicePixelRatio = useDevicePixelRatio();
|
||||
|
||||
const { maxX, maxY } = artboardBounds ?? {};
|
||||
|
||||
const getCanvasDimensions = useCallback(() => {
|
||||
const width = containerRef.current?.clientWidth ?? 0;
|
||||
const height = containerRef.current?.clientHeight ?? 0;
|
||||
@@ -73,7 +75,7 @@ export default function useResizeCanvas({
|
||||
width,
|
||||
height,
|
||||
};
|
||||
}, [containerRef, fitCanvasToArtboardHeight, artboardBounds]);
|
||||
}, [containerRef, fitCanvasToArtboardHeight, maxX, maxY]);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
@@ -131,7 +133,7 @@ export default function useResizeCanvas({
|
||||
if (onCanvasHasResized && (isFirstSizing || hasResized)) {
|
||||
onCanvasHasResized && onCanvasHasResized();
|
||||
}
|
||||
setIsFirstSizing(false);
|
||||
isFirstSizing && setIsFirstSizing(false);
|
||||
}, [
|
||||
canvasRef,
|
||||
containerRef,
|
||||
|
||||
Reference in New Issue
Block a user