From 35aae54d49c0a17f780259ebab84b0c227e1bee8 Mon Sep 17 00:00:00 2001 From: Tanish Manku Date: Tue, 28 Apr 2026 22:56:38 -0700 Subject: [PATCH] fix: let UploadSuccess actually render in upload modals The auto-success useEffect in UploadModalSplat / UploadModalImage / UploadModal3D was firing on UploaderStates.success and immediately calling onClose(), which short-circuited the UploaderModalContent switch before the UploaderStates.success branch (UploadSuccess) could render. The OK button on UploadSuccess was effectively dead code. Move the success-side actions (open the gallery, fire onSuccess, close the modal) into the UploadSuccess onOk handler. The user now sees the "upload successful" dialog and can dismiss it intentionally; the gallery opens at dismissal so they can drag the freshly uploaded asset onto the canvas. --- .../reusable/UploadModal3D/UploadModal3D.tsx | 17 +++++------------ .../UploadModalImage/UploadModalImage.tsx | 17 +++++------------ .../UploadModalSplat/UploadModalSplat.tsx | 18 +++++------------- 3 files changed, 15 insertions(+), 37 deletions(-) diff --git a/frontend/apps/artcraft/app/src/components/reusable/UploadModal3D/UploadModal3D.tsx b/frontend/apps/artcraft/app/src/components/reusable/UploadModal3D/UploadModal3D.tsx index 9f6783cd31..b7b00e9dc6 100644 --- a/frontend/apps/artcraft/app/src/components/reusable/UploadModal3D/UploadModal3D.tsx +++ b/frontend/apps/artcraft/app/src/components/reusable/UploadModal3D/UploadModal3D.tsx @@ -73,17 +73,6 @@ export function UploadModal3D(props: Props) { } }, [isOpen]); - useEffect(() => { - if (uploaderState.status === UploaderStates.success) { - // Automatically open the global Gallery modal after a successful upload - galleryModalVisibleViewMode.value = true; - galleryModalVisibleDuringDrag.value = true; - - onSuccess(selectedCategory); - onClose(); - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [uploaderState.status]); const UploaderModalContent = () => { switch (uploaderState.status) { @@ -130,8 +119,12 @@ export function UploadModal3D(props: Props) { { - onClose(); + // Open the gallery so the user can drag the freshly + // uploaded model onto the canvas. + galleryModalVisibleViewMode.value = true; + galleryModalVisibleDuringDrag.value = true; onSuccess(selectedCategory); + onClose(); }} /> ); diff --git a/frontend/apps/artcraft/app/src/components/reusable/UploadModalImage/UploadModalImage.tsx b/frontend/apps/artcraft/app/src/components/reusable/UploadModalImage/UploadModalImage.tsx index df25115a24..c90c9d8a69 100644 --- a/frontend/apps/artcraft/app/src/components/reusable/UploadModalImage/UploadModalImage.tsx +++ b/frontend/apps/artcraft/app/src/components/reusable/UploadModalImage/UploadModalImage.tsx @@ -48,17 +48,6 @@ export function UploadModalImage(props: Props) { } }, [isOpen]); - useEffect(() => { - if (uploaderState.status === UploaderStates.success) { - // Automatically open the global Gallery modal after a successful upload - galleryModalVisibleViewMode.value = true; - galleryModalVisibleDuringDrag.value = true; - - onSuccess(selectedCategory); - onClose(); - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [uploaderState.status]); const UploaderModalContent = () => { switch (uploaderState.status) { @@ -94,8 +83,12 @@ export function UploadModalImage(props: Props) { { - onClose(); + // Open the gallery so the user can drag the freshly + // uploaded image onto the canvas. + galleryModalVisibleViewMode.value = true; + galleryModalVisibleDuringDrag.value = true; onSuccess(selectedCategory); + onClose(); }} /> ); diff --git a/frontend/apps/artcraft/app/src/components/reusable/UploadModalSplat/UploadModalSplat.tsx b/frontend/apps/artcraft/app/src/components/reusable/UploadModalSplat/UploadModalSplat.tsx index d036833472..33099a2966 100644 --- a/frontend/apps/artcraft/app/src/components/reusable/UploadModalSplat/UploadModalSplat.tsx +++ b/frontend/apps/artcraft/app/src/components/reusable/UploadModalSplat/UploadModalSplat.tsx @@ -52,18 +52,6 @@ export function UploadModalSplat(props: Props) { } }, [isOpen]); - useEffect(() => { - if (uploaderState.status === UploaderStates.success) { - // Match the image / 3D-model upload flow: open the gallery so the - // user can drag the freshly uploaded splat onto the canvas. - galleryModalVisibleViewMode.value = true; - galleryModalVisibleDuringDrag.value = true; - - onSuccess(selectedCategory); - onClose(); - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [uploaderState.status]); const UploaderModalContent = () => { switch (uploaderState.status) { @@ -103,8 +91,12 @@ export function UploadModalSplat(props: Props) { { - onClose(); + // Open the gallery so the user can drag the freshly + // uploaded splat onto the canvas. + galleryModalVisibleViewMode.value = true; + galleryModalVisibleDuringDrag.value = true; onSuccess(selectedCategory); + onClose(); }} /> );