mirror of
https://github.com/Afilmory/afilmory
synced 2026-06-01 19:05:42 +00:00
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
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}, [])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user