Skip to content

fix(code): restore zoom after external resize#3571

Merged
richardsolomou merged 5 commits into
mainfrom
posthog-code/fix-zoom-task-navigation
Jul 20, 2026
Merged

fix(code): restore zoom after external resize#3571
richardsolomou merged 5 commits into
mainfrom
posthog-code/fix-zoom-task-navigation

Conversation

@richardsolomou

@richardsolomou richardsolomou commented Jul 20, 2026

Copy link
Copy Markdown
Member

Problem

External window managers such as Magnet or Rectangle can resize the Electron window without emitting the manual-resize completion event. Chromium can reset the visible zoom to 100% while the app still tracks the previous level, so the next zoom input jumps from a stale baseline.

Why: Window snapping should not change the visible app zoom or desynchronise it from the stored level.

Closes #2959

Changes

Restore the current in-memory zoom after every Electron resize event, but only call setZoomLevel when Chromium has diverged from it. Ignore queued work after renderer teardown and keep wheel zoom changes serialized with restoration.

How did you test this?

  • Added regression coverage for delayed external resets, spaced resize storms, both resize event variants, wheel zoom races, and renderer teardown.
  • pnpm --filter code exec vitest run src/main/zoom.test.ts
  • pnpm turbo typecheck --filter=@posthog/code
  • pnpm exec biome check apps/code/src/main/zoom.ts apps/code/src/main/zoom.test.ts

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code

Generated-By: PostHog Code
Task-Id: 33078092-6d41-45e8-8375-157f66bcea43
@trunk-io

trunk-io Bot commented Jul 20, 2026

Copy link
Copy Markdown

😎 Merged manually by @richardsolomou - details.

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 0f7864e.

Generated-By: PostHog Code
Task-Id: 33078092-6d41-45e8-8375-157f66bcea43
@richardsolomou richardsolomou changed the title fix(code): preserve zoom across task navigation fix(code): restore zoom after external resize Jul 20, 2026
@posthog

posthog Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Visual changes approved by @richardsolomou — baseline updated in 0f7864e.

View this run in PostHog

1 changed.

Generated-By: PostHog Code
Task-Id: 33078092-6d41-45e8-8375-157f66bcea43
Generated-By: PostHog Code
Task-Id: 33078092-6d41-45e8-8375-157f66bcea43
@richardsolomou
richardsolomou marked this pull request as ready for review July 20, 2026 06:14
@greptile-apps

greptile-apps Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(code): avoid redundant zoom restorat..." | Re-trigger Greptile

@richardsolomou
richardsolomou requested a review from a team July 20, 2026 06:19
1 updated
Run: 2ef00186-bf99-4380-a1a0-a510133e43c2

Co-authored-by: richardsolomou <2622273+richardsolomou@users.noreply.github.com>
@richardsolomou
richardsolomou merged commit de18c49 into main Jul 20, 2026
29 of 30 checks passed
@richardsolomou
richardsolomou deleted the posthog-code/fix-zoom-task-navigation branch July 20, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zoom level resetting

2 participants