Skip to content

Commit 0182283

Browse files
authored
1 parent 427f680 commit 0182283

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

frontend/src/Editor/SubContainer.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ export const SubContainer = ({
3939
const [_containerCanvasWidth, setContainerCanvasWidth] = useState(0);
4040

4141
useEffect(() => {
42-
const canvasWidth = parentRef?.current ? getContainerCanvasWidth() : 0;
43-
setContainerCanvasWidth(canvasWidth);
42+
if (parentRef.current) {
43+
const canvasWidth = getContainerCanvasWidth();
44+
setContainerCanvasWidth(canvasWidth);
45+
}
4446
// eslint-disable-next-line react-hooks/exhaustive-deps
45-
}, [parentRef.current]);
47+
}, [parentRef, getContainerCanvasWidth()]);
4648

4749
zoomLevel = zoomLevel || 1;
4850

0 commit comments

Comments
 (0)