From c076b2251f3d24712c902fce0bafd59d85ef578c Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Mar 2026 12:58:25 +0000 Subject: [PATCH] fix: prevent backdrop flash on close by not resetting isClosing before navigation setIsClosing(false) ran before closeViewer() navigated away, which momentarily set isOpen back to true (URL still had the photoId), causing the backdrop to flash for one frame. Now we only reset isClosing in the cancelled-close branch; the active-close branch navigates directly and lets the component unmount. https://claude.ai/code/session_01GE9xCcB59MnZiERpgBXxo8 --- apps/web/src/pages/(main)/photos/[photoId]/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/web/src/pages/(main)/photos/[photoId]/index.tsx b/apps/web/src/pages/(main)/photos/[photoId]/index.tsx index fb1ddd60..b59cd438 100644 --- a/apps/web/src/pages/(main)/photos/[photoId]/index.tsx +++ b/apps/web/src/pages/(main)/photos/[photoId]/index.tsx @@ -47,10 +47,14 @@ export const Component = () => { }, []) const handleExitComplete = useCallback(() => { - setIsClosing(false) if (isCloseActiveRef.current) { isCloseActiveRef.current = false + // Navigate away — the component unmounts so no need to reset isClosing. + // Resetting it before navigation would momentarily flip isOpen back to true + // (the URL still has the photoId), causing the backdrop to flash. closeViewerRef.current() + } else { + setIsClosing(false) } }, [])