Skip to content

fix(detail): mount WebGL viewer when opening fullscreen from the toolbar#528

Merged
Zheaoli merged 1 commit into
mainfrom
fix/zoom-viewer-mount-gate
Jun 11, 2026
Merged

fix(detail): mount WebGL viewer when opening fullscreen from the toolbar#528
Zheaoli merged 1 commit into
mainfrom
fix/zoom-viewer-mount-gate

Conversation

@Zheaoli

@Zheaoli Zheaoli commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

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:

keepViewerMounted={zoomLru.includes(photo.id)}

The toolbar fullscreen button only did setLightboxPhoto(true) — it never added the photo to zoomLru. So for any photo not already zoomed via the in-image path, keepViewerMounted stayed false, the ProgressiveImage mount-gate hasOpenedFullScreen && keepViewerMounted !== false evaluated to false, and the viewer's container never mounted → blank fullscreen. The in-image zoom path worked only because its onShowLightboxChange handler 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)

  1. Bump the LRU from the toolbar button too, mirroring the in-image onShowLightboxChange path (guarded with current?.id against an undefined fallback id).
  2. Mount-gate keeps the current photo's viewer mounted while its lightbox is open: 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.

…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>
@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
picimpact Ready Ready Preview, Comment Jun 11, 2026 8:40am

@Zheaoli Zheaoli merged commit f03b76f into main Jun 11, 2026
6 checks passed
@Zheaoli Zheaoli deleted the fix/zoom-viewer-mount-gate branch June 11, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant