Skip to content

fix(desktop): account for main-window zoom in preview_resize - #12718

Open
macodev00 wants to merge 1 commit into
pingdotgg:mainfrom
macodev00:cursor/preview-resize-host-zoom-9105
Open

macodev00 wants to merge 1 commit into
pingdotgg:mainfrom
macodev00:cursor/preview-resize-host-zoom-9105

Conversation

@macodev00

@macodev00 macodev00 commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

What

  • Set preview guest webview zoom to tab.zoomFactor × mainWindow zoom so preview_resize matches CSS size when the main window is zoomed.

Why

Fixes #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%.

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.

…oomed

preview_resize compared guest innerWidth to the declared CSS size. A zoomed
app window made the guest report innerWidth × windowZoom, so the wait never
succeeded and the automation host was evicted.

Guest zoom is now tab.zoomFactor × the main window zoom factor; stored
preview zoom stays unchanged.

Co-authored-by: maco <macodev00@users.noreply.github.com>
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Sep 20, 2026
@macodev00
macodev00 marked this pull request as ready for review September 20, 2026 09:20
@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

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 7445aa7 and bdd04f6.

📒 Files selected for processing (3)
  • apps/desktop/src/preview/Manager.test.ts
  • apps/desktop/src/preview/Manager.ts
  • apps/desktop/src/window/DesktopWindow.ts

Included 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

Layer / File(s) Summary
Apply combined guest zoom
apps/desktop/src/preview/Manager.ts, apps/desktop/src/window/DesktopWindow.ts
PreviewManager validates and reads the main window zoom, then applies tabZoom × windowZoom during registration, assertion, reapplication, and updates. Comments describe the combined behavior.
Validate combined zoom behavior
apps/desktop/src/preview/Manager.test.ts
Tests cover default zoom, zoom-in updates, reapplyZoom, and a custom preview zoom of 1.25 with a main window zoom of 1.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)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #12319 requires preview resize to succeed when the main window is zoomed and the guest to report the requested CSS viewport. Manager.ts now reads the main window zoom and applies `tab.zoomFact…
Out of Scope Changes check ✅ Passed The changes stay within issue #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 …
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…
Title check ✅ Passed The title clearly identifies the desktop fix: applying main-window zoom to preview resizing.
Description check ✅ Passed The description explains what changed, why it changed, the UI impact, and the focused scope. It provides checklist information and appropriately marks UI screenshots as not applicable.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@macodev00

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to 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.

@macodev00

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to 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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

1 participant