Repository navigation
perf(ui): load the media lightbox on open - #174830
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c221b737d7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <Loading> | ||
| <Content {...props} host={host} /> | ||
| </Loading> |
There was a problem hiding this comment.
Add an error surface for the lazy lightbox chunk
When a tab survives a Gateway update while a New Session draft blocks document reload, this dynamic import can request a now-removed hashed chunk. installStaleChunkReloadListener cannot reload in that guarded state, and this Loading boundary has no Errored fallback or retry, so clicking an attachment produces an empty host with no explanation or actionable recovery. Wrap the lazy content in the same visible stale-chunk error/retry handling used by other lazy UI surfaces.
AGENTS.md reference: AGENTS.md:L79-L82
Useful? React with 👍 / 👎.
|
Codex review: needs changes before merge. What this changesThis PR loads the shared image and video lightbox renderer when media opens instead of during Chat or New Session boot. Example: Open Chat without opening an attachment.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep this maintainer-authored PR open: deferring unused viewer code is worthwhile, but chunk-load recovery and an affected CI fixture need repair. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherChat and New Session pass selected media and resource callbacks into a native bridge host, whose renderer owns the modal, gallery, zoom controls, and resource cleanup. flowchart LR
A[Chat or New Session] --> B[Selected media]
B --> C[Native lightbox host]
C --> D[Lazy renderer import]
D --> E[Modal and gallery]
E --> F[Media resources and zoom]
Technical reviewBest possible solution: Retain the lazy renderer while adding visible, draft-safe import recovery and updating the retained-pane fixture to await modal readiness. Do we have a high-confidence way to reproduce the issue? Source establishes both eager loading on main and the rejected-import path without local recovery; exact-head CI independently records the affected modal-readiness assertion. Is this the best way to solve the issue? Splitting the existing renderer behind its stable native host is a focused optimization, provided loading failures remain visible and recoverable. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a1bb732d30bc. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceSource +10, Tests +39. Total +49 across 5 files. Added test files: 1. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 16, 2026, 7:46 PM ET / 23:46 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
* perf(ui): load the media lightbox on open * test(ui): await the lazy lightbox in retained panes
What Problem This Solves
Opening Chat or New Session loaded the complete image/video lightbox, Panzoom, gallery navigation, and download helpers before the user opened any media.
User Impact
Chat boot avoids 10,898 B gzip of JavaScript and New Session avoids 10,945 B, with unchanged request counts. The existing native tag, properties, media ownership, zoom controls, and close behavior remain intact.
Implementation
Keep the native
openclaw-image-lightboxregistration in its small existing entry. Load the single renderer with Solid'slazy/Loadingwhen that host mounts. The renderer's native host identity stays fixed; media props remain live while the import resolves. Regenerate the canonical cold/warm boot manifest so the viewer, Panzoom, and its inline styles leave both boot graphs.The browser fixture now waits for the lazy dialog, and a delayed-import regression verifies current media props and removal before the renderer resolves. Existing media/download/zoom tests remain intact. No dependency or route changes, and no rendered style/content changes requiring screenshots.
Proof
Same machine/toolchain, fixed timestamp and build ID; base
cfd38b92ce040b7638b69bf06e48aa4030bfa5ae.pnpm tsgo:ui, targeted lint/format, production Knip, andgit diff --check: pass.ci:fullselects all UI unit/E2E, browser-extension, and real-Gateway shards.untrackThe extra
untrackcaptures the fixed native host once; the other snapshots the title without resetting media when renamed. Existing effects synchronize the gallery/media owner and native player. This focused loading-boundary change adds a small wrapper rather than duplicating a renderer. No state owner or new abstraction was added.Full CI found one retained-presentation test still assuming that opening the image host synchronously creates its modal. It now waits for the dynamic renderer before checking modal registration and parking cleanup. The complete retained-presentation file passes all 21 cases locally. Production inputs and the measured bundle graph are unchanged by this test-only correction. Independent review of the correction found no actionable P0–P2 findings.
CI attribution
Replacement-head CI run 38983358524 passes the UI unit tests and all selected checks except the six metadata-observation cases already failing on scheduled main 38981593815. Each is
shares pending catalog reads across metadata invalidations(single, shared, late follower, late follower without metadata, late follower without metadata/metadata first, late follower/catalog first):models.listreceived 3 versus expected 2. The test and four request-owner source blobs are identical between the tested merge, its main parent, and scheduled main. Landing uses the native inherited-failure route; CI is not claimed green.