From c4298cc02b42015360892f4eb08cadad2dd9fc0e Mon Sep 17 00:00:00 2001 From: Tanish Manku Date: Sat, 31 Jan 2026 01:22:52 -0800 Subject: [PATCH] Make sure to run autocentering when the base image changes (#1023) --- frontend/apps/artcraft/app/src/pages/PageDraw/PageDraw.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/apps/artcraft/app/src/pages/PageDraw/PageDraw.tsx b/frontend/apps/artcraft/app/src/pages/PageDraw/PageDraw.tsx index f6f8dd4f5e..cba265e72c 100644 --- a/frontend/apps/artcraft/app/src/pages/PageDraw/PageDraw.tsx +++ b/frontend/apps/artcraft/app/src/pages/PageDraw/PageDraw.tsx @@ -568,6 +568,10 @@ const PageDraw = () => { // Auto-fit canvas to screen on initial load useEffect(() => { + if (!store.baseImageBitmap) { + return; + } + const autoFitCanvas = async () => { let attempts = 0; const maxAttempts = 20; @@ -593,7 +597,7 @@ const PageDraw = () => { autoFitCanvas(); // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); + }, [store.baseImageBitmap]); // Display image selector on launch, otherwise hide it // Also show loading state if info is set but image is loading