Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

Closedmacodev00(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/12718/headopened View on GitHub

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 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

    2. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      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 7445aa733ada33e45289e5aa5055f79142556513 and bdd04f6c91e377dade50094cd1bea1d8e781d89c.

      📒 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 nameStatusExplanation
      Linked Issues check✅ PassedIssue #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✅ PassedThe 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✅ PassedNo 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✅ PassedThe title clearly and concisely identifies the main change: accounting for main-window zoom in preview resizing.
      Description check✅ PassedThe description explains the problem, fix, linked issue, verification results, test limitations, and scope. It uses custom headings instead of the template headings, but it provides the required infor…
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR

      Comment `@coderabbitai help` to get the list of available commands.
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      ⚠️ 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.

    4. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      ⚠️ 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.

    5. 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.

    6. juliusmarminge closed this

Sign in to join this conversation.