fix(files): attach wheel listener before paint and guard SVG src#4744
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryLow Risk Overview This is a tooling-only change for monorepo scripts ( Reviewed by Cursor Bugbot for commit c5ddbcb. Configure here. |
Greptile SummaryThis PR is a targeted follow-up bug fix to #4741, addressing two edge cases in the file preview components identified during a post-merge review.
Confidence Score: 5/5Both changes are minimal, well-scoped, and directly address the reported bugs without touching any unrelated logic. The No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant B as Browser
participant R as React
participant VP as Viewport DOM
participant WL as Wheel Listener
Note over R,VP: Before fix (useEffect)
R->>VP: DOM mutations committed
B->>B: Browser paints frame
Note over B,WL: ⚠️ Pinch here escapes to page zoom
R->>WL: useEffect fires → listener attached
Note over R,VP: After fix (useLayoutEffect)
R->>VP: DOM mutations committed
R->>WL: useLayoutEffect fires → listener attached
Note over WL: ✅ Listener in place before paint
B->>B: Browser paints frame
B->>WL: Pinch captured → preventDefault() → component zoom
Reviews (2): Last reviewed commit: "chore(deps): upgrade turbo to 2.9.14" | Re-trigger Greptile |
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit c5ddbcb. Configure here.
Summary
ZoomablePreview's wheel-listener binding fromuseEffecttouseLayoutEffectso the native non-passive listener attaches before the browser paints. Closes the few-ms window after mount where a trackpad pinch could still zoom the browser page (the original bug fix(files): zoom file viewer content, not the browser page #4741 was meant to fix).<img>with{blobUrl && ...}so it doesn't render with an emptysrcon the first commit. Avoids the spec-edge-case current-document fetch and the broken-image flash before the effect populates the blob URL.Context
Follow-up to #4741 — both findings flagged by Cursor Bugbot review on the merged commit.
Type of Change
Testing
Tested manually — pinch immediately after opening an image, PDF, DOCX, or PPTX preview no longer escapes to the browser. SVG previews no longer flash a broken-image icon on first render.
Checklist