diff --git a/src/photo/PhotoUploadWithStatus.tsx b/src/photo/PhotoUploadWithStatus.tsx index 4702d0de..1fd8ff38 100644 --- a/src/photo/PhotoUploadWithStatus.tsx +++ b/src/photo/PhotoUploadWithStatus.tsx @@ -56,17 +56,22 @@ export default function PhotoUploadWithStatus({ const shouldResetUploadStateAfterPending = useRef(false); const [isPending, startTransition] = useTransition(); + // Only reset upload state after route transition completes useEffect(() => { if (!isPending && shouldResetUploadStateAfterPending.current) { resetUploadState?.(); shouldResetUploadStateAfterPending.current = false; } + }, [isPending, resetUploadState]); + // Reset upload state when component unmounts + // when not reset during route transition + useEffect(() => { return () => { if (shouldResetUploadStateAfterPending.current) { resetUploadState?.(); } }; - }, [isPending, resetUploadState]); + }, [resetUploadState]); const isFinishing = isPending && shouldResetUploadStateAfterPending.current; const uploadNumberText = `${fileUploadIndex + 1} of ${filesLength}`; @@ -147,14 +152,15 @@ export default function PhotoUploadWithStatus({ {isUploading ? isFinishing ? <> - Finishing + Finishing ... : <> - {!showButton && + {!showButton && <> Uploading {uploadNumberText} - } - {': '} + + {': '} + } {fileUploadName} : !showButton && <>Initializing} diff --git a/src/state/AppStateProvider.tsx b/src/state/AppStateProvider.tsx index ed7ceb17..2bb492dc 100644 --- a/src/state/AppStateProvider.tsx +++ b/src/state/AppStateProvider.tsx @@ -134,8 +134,6 @@ export default function AppStateProvider({ }, ); - console.log('adminData', adminData); - useEffect(() => { if (userEmail) { storeAuthEmailCookie(userEmail);