fix(desktop): account for main-window zoom in preview_resize #12718
main fromrefs/pull/12718/head·opened View on GitHubWhat#
- Set preview guest webview zoom to
tab.zoomFactor × mainWindow zoomsopreview_resizematches CSS size when the main window is zoomed.
Why#
Fixes https://github.com/pingdotgg/t3code/issues/12319
The guest was reset to preview-only zoom while Chromium multiplies layout by main-window zoom, so a 1280×800 request reported ~2019×1262 and the wait always timed out (evicting the automation host).
UI#
N/A for product chrome — preview automation resize succeeds while View → Zoom is above 100%.
Verification#
From apps/desktop at commit bdd04f6c9:
vp test run src/preview/Manager.test.ts
Result: 1 file passed, 91 tests passed (1.68s). The zoomed-window coverage is "applies preview zoom times the main window zoom onto the guest" and "keeps a 1.25 preview zoom at the declared CSS size when the window is zoomed".
vp run typecheck
Result: passed (exit 0, 4.47s). tsc --noEmit reported suggestions only.
Limitations: Ran on Linux x64 with the guest webContents zoom mocked. Not checked in a real Electron window on macOS or Windows.
Checklist#
- I read CONTRIBUTING.md and kept this small / bug-only
- What + why explained above
- Followed AGENTS.md documentation rules (no new docs)
- No unrelated changes
- CLA / AI-reviewed standing override for macodev00 auto-contrib
Summary by CodeRabbit#
Bug Fixes
- Preview content now correctly combines its configured zoom with the desktop window’s zoom, keeping embedded previews visually consistent when the app zoom changes.
- Zoom handling remains stable when the window is unavailable, invalid, or has an unusual zoom value.
Tests
- Added coverage for default zoom, zoom updates, zoom reapplication, and custom preview and window zoom combinations.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
@coderabbitai review
⚠️ Action not completed
Already reviewed the last commit. Use
@coderabbitai full reviewto rerun a review of the entire changeset.Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
@coderabbitai review
⚠️ Action not completed
Already reviewed the last commit. Use
@coderabbitai full reviewto rerun a review of the entire changeset.Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
Note
This comment is posted by Julius' dot
The change follows #12319's direction, but the 91 tests mock guest zoom and do not demonstrate the requested CSS viewport or a completed resize in Electron. The PR states that no real window was checked. Under the verification rule, please attach before/after evidence and a short recording of preview_resize at non-default window and preview zoom, showing the measured viewport and successful completion, then request reconsideration.
juliusmarminge closed this
Sign in to join this conversation.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
81fa5ee0-48a0-4a7d-945d-0bb952f66f68📥 Commits
Reviewing files that changed from the base of the PR and between 7445aa733ada33e45289e5aa5055f79142556513 and bdd04f6c91e377dade50094cd1bea1d8e781d89c.
📒 Files selected for processing (3)
apps/desktop/src/preview/Manager.test.tsapps/desktop/src/preview/Manager.tsapps/desktop/src/window/DesktopWindow.tsIncluded review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review.
📝 Walkthrough
Walkthrough#
Preview guests now use the product of their preview zoom and the main window zoom. Invalid or unavailable window zoom values fall back to
1.0. Tests cover default, updated, reapplied, and custom zoom values.Changes#
Preview guest zoom alignment
apps/desktop/src/preview/Manager.ts,apps/desktop/src/window/DesktopWindow.tsPreviewManagervalidates and reads the main window zoom, then appliestabZoom × windowZoomduring registration, assertion, reapplication, and updates. Comments describe the combined behavior.apps/desktop/src/preview/Manager.test.tsreapplyZoom, and a custom preview zoom of1.25with a main window zoom of1.2 ** 2.5.Priority: ➖ Normal
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers:
juliusmarminge🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
#12319requires preview resize to succeed when the main window is zoomed and the guest to report the requested CSS viewport.Manager.tsnow reads the main window zoom and applies `tab.zoomFact…#12319. They update preview guest zoom handling, add focused automated tests, and update related comments. No product chrome UI changes or unrelated behavior changes are …✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment `@coderabbitai help` to get the list of available commands.