fix(detail): mount WebGL viewer when opening fullscreen from the toolbar#528
Merged
Conversation
…oolbar
The fullscreen ("View fullscreen") toolbar button only set
`lightboxPhoto = true`; it did not add the current photo to the zoomed-
viewer LRU. Because the LRU cap added in the detail-viewer work gates the
WebGL viewer mount on `keepViewerMounted={zoomLru.includes(photo.id)}`,
opening fullscreen for a photo that had never been zoomed via the in-image
path left `keepViewerMounted=false`, so the viewer never mounted and the
fullscreen view was blank. The in-image zoom path worked only because it
bumps the LRU.
Two complementary fixes:
- Bump the LRU from the toolbar button too (guarded against an undefined
fallback id), matching the in-image `onShowLightboxChange` path.
- Make the mount-gate keep the viewer mounted whenever the current photo's
lightbox is open (`isCurrent && lightboxPhoto`), so any path that opens
the lightbox mounts the viewer regardless of LRU membership. The LRU
still caps background (closed) zoomed viewers, so the <=3 live-context
bound is preserved.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Symptom
Opening a photo's fullscreen zoom from the "View fullscreen" toolbar button (the ⛶ icon) shows a blank view — the WebGL viewer never appears.
Root cause
The detail-viewer LRU cap gates the WebGL viewer mount on:
The toolbar fullscreen button only did
setLightboxPhoto(true)— it never added the photo tozoomLru. So for any photo not already zoomed via the in-image path,keepViewerMountedstayedfalse, the ProgressiveImage mount-gatehasOpenedFullScreen && keepViewerMounted !== falseevaluated tofalse, and the viewer's container never mounted → blank fullscreen. The in-image zoom path worked only because itsonShowLightboxChangehandler bumps the LRU.(Confirmed by devtools: clicking the toolbar button produced no viewer canvas at all — not a WebGL/context failure, the element simply wasn't rendered. Clicking the image body, which bumps the LRU, did mount the viewer.)
Fix (two complementary changes)
onShowLightboxChangepath (guarded withcurrent?.idagainst an undefined fallback id).keepViewerMounted={zoomLru.includes(photo.id) || (isCurrent && lightboxPhoto)}. This makes any path that opens the lightbox mount the viewer, independent of LRU membership.The LRU still caps background/closed zoomed viewers, so the ≤3 live-WebGL-context bound from the LRU work is preserved (the currently-open photo should always be mounted anyway).
Verify
After deploy: open a photo → click the ⛶ "View fullscreen" button → the zoomable WebGL image should appear (previously blank). Also confirm switching/closing/re-opening still respects the ≤3 context cap.