Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): app zoom no longer zooms the preview browser #6649

Mergedjuliusmarmingemerged 2 commits intomain fromrefs/pull/6649/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Zooming the app UI (View → Zoom In/Out) also zoomed whatever the preview browser was showing, so there was no way to shrink T3's chrome without shrinking the previewed page with it — which is what Tanner asked for: "zoom T3's UI out, but not the browser".

Chromium hands every guest <webview> the embedder's zoom level, and PreviewManager then read that level back off the guest, so an app zoom silently became the preview's own zoom (and the zoom indicator reported it).

The tab's zoom factor is now the only source of truth: it is asserted onto the guest whenever a webview attaches, re-asserted after every app zoom, and never read back off the guest.

Before / after

App zoomed out two steps, same window, same page. The readout is the previewed page's own devicePixelRatio and viewport.

Before — the page shrinks with the UI (devicePixelRatio drops to 1.67):

before

After — the UI shrinks, the page stays at true scale (devicePixelRatio stays 2.00; the guest just gets a narrower viewport as the panel gets physically smaller):

after

At 100% both builds are identical, and the preview's own zoom controls are unchanged:

baseline

Notes

  • Desktop-only: the preview browser is an Electron <webview>, so web and mobile are unaffected.
  • One behaviour change worth calling out: a zoom the user makes inside the guest (ctrl+wheel) is no longer mirrored into the tab state. That mirror was the leak — it could not tell an inherited app zoom from a real one — and T3's own zoom controls remain the way to zoom the preview.
  • Verified in the desktop app (screenshots above) plus focused tests in Manager.test.ts and DesktopWindow.test.ts.

Model: Claude Opus 5 (1M context). Harness: Claude Code inside T3 Code.

🤖 Generated with Claude Code


Note

Medium Risk Touches desktop preview webview lifecycle and zoom synchronization; behavior change for guest-reported zoom, but scoped to Electron preview and covered by new tests.

Overview App UI zoom no longer changes the previewed page’s scale. Chromium was inheriting the main window zoom into guest <webview>s, and PreviewManager then mirrored getZoomFactor() back into tab state—so View → Zoom In/Out affected both chrome and the preview.

Tab zoomFactor is now authoritative: syncWebContentsState stops reading zoom from the guest; assertTabZoom pushes the stored factor onto the active webContents (including after async attach and on duplicate registerWebview); new reapplyZoom resets every tab’s guest after app zoom. DesktopWindow.zoomMain calls reapplyZoom() after each main-window zoom step.

Behavior change: in-guest zoom (e.g. ctrl+wheel) is no longer synced into tab state; preview zoom stays on T3’s own controls. Tests cover tab-owned zoom, reapplyZoom, re-register paths, and desktop window integration.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0a46468dc59a53a30a595ea8cc942327c93711b6. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Fix app window zoom from affecting preview browser tab zoom

  • Embedded preview guests inherit the host window's zoom level, causing app zoom to unintentionally rescale preview content.
  • PreviewManager now tracks each tab's own zoom factor and asserts it onto the guest on registration, re-registration, and navigation, rather than reading the guest's zoom back into state.
  • A new reapplyZoom() method on PreviewManager iterates all tabs and pushes their zoom to attached guests; DesktopWindow.zoomMain calls this after each window zoom change.
  • Behavioral Change: the manager no longer adopts zoom from guests — guest zoom is always overwritten by the tab's stored value on attach.
Macroscope summarized 0a46468.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: ee8ebdca-8e83-4091-8a01-7db95afbeec9

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

      Fix All in Cursor Bugbot Autofix is [ON](https://www.cursor.com/dashboard/bugbot), but a cloud agent failed to start. Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 3916a4d5dab6b62d3b22a846d325337dce178bdd. Configure [here](https://www.cursor.com/dashboard/bugbot).
    4. github-actions[bot](GitHub profile, opens in a new tab)commented

      Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire11.3 KiB11.3 KiB+24 B (+0.2%)15.1 KiB✅
      CodexThread snapshot wire5.5 KiB5.5 KiB+5 B (+0.1%)7.3 KiB✅
      CodexLive turn WebSocket wire5.9 KiB5.9 KiB+19 B (+0.3%)7.8 KiB✅
      CodexLive turn WebSocket decoded49.7 KiB49.7 KiB0 B (0.0%)66.4 KiB✅
      CodexLive turn messages16160 (0.0%)21✅
      ClaudeTotal thread wire11.4 KiB11.3 KiB−24 B (−0.2%)15.1 KiB✅
      ClaudeThread snapshot wire5.5 KiB5.5 KiB−3 B (−0.1%)7.3 KiB✅
      ClaudeLive turn WebSocket wire5.9 KiB5.9 KiB−21 B (−0.3%)7.8 KiB✅
      ClaudeLive turn WebSocket decoded50.6 KiB50.6 KiB0 B (0.0%)66.4 KiB✅
      ClaudeLive turn messages16160 (0.0%)21✅

      Baseline: e9ae134 · PR result: 0a46468 · Source CI: success

      Scenario and decoded snapshot size

      10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

      • Codex decoded thread snapshot: 94.6 KiB
      • Claude decoded thread snapshot: 95.4 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

    5. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved 0a46468

      Straightforward bug fix that corrects zoom isolation between the desktop app UI and the preview browser. The scope is limited to zoom handling logic, the intent is clear, and comprehensive unit tests validate the new behavior.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    6. Addressed in 0a46468 — both bots flagged the same thing from two angles, so I fixed it at the source rather than patch-by-patch.

      What was wrong. Three places applied a tab snapshot taken before an await: the registerWebview fast path, the full attach path (which also wrote its pre-attachListeners factor into the committed state), and reapplyZoom. A zoom action landing in that window could be rolled back on the guest, and the fast path additionally wrote its stale factor back over tab state.

      Fix. One helper, assertTabZoom(tabId), reads the tab and resolves its guest at the moment it applies, and every post-await application goes through it. The fast path no longer republishes unchanged tab state (that write could only ever clobber), the attach path no longer writes its own zoomFactor into the committed state, and a swapped-in guest settles on the committed factor after the commit lands.

      On reachability, so the record is straight: I could not build a failing test for the fast-path window — every step between the read and the apply is synchronous, so the fiber never suspends there and the interleaving does not occur today. It is reachable in the attach path, which does suspend. I kept the change anyway because it removes the hazard class and is smaller than what it replaces, but I am not claiming a test proves the race. What the new test does cover is behaviour this PR introduces and nothing else covered: re-registering the already-attached guest re-asserts the tab's zoom without republishing state. It fails against main.

      Re-verified end to end in the desktop app on the updated build — previewed page holds devicePixelRatio 2.00 across four zoom-out steps, zoom-in, and reset, while its viewport tracks the panel. 74 tests, lint, and typecheck green.

    7. juliusmarminge merged thisd8a6dfd

    8. juliusmarminge closed this

Sign in to join this conversation.