Repository navigation
Conversation
|
The following comment was made by an LLM, it may be inaccurate: |
|
Opened from the rebased branch discussed in #50169, now that it applies cleanly to
The only remaining blocker is a code-owner review — everything else is green (non-draft, bot checks pass, small self-contained change). This supersedes #50169. |
There was a problem hiding this comment.
The approach is sound: the zoom factor is saved in the main-process settings store, restored when windows are created and in wireZoom, and the IPC, menu and pinch paths all go through setZoomFactor. I could not run it: the desktop app can't be launched in this environment. bun run typecheck in packages/desktop passes. The Electron test could not start here, and it is skipped when CI is set.
Public API: unchanged. It only adds an internal zoomFactor key to the desktop settings file. That is backwards compatible: missing or invalid values fall back to 1.
Worth fixing before merge (details inline):
- Every zoom change now does a synchronous whole-file write of the settings file. The renderer's ctrl+wheel/trackpad pinch handler calls
setZoomFactorwith continuous values many times per second, so a pinch becomes a burst of file writes in the main process.packages/desktop/AGENTS.mdspecifically warns about file system writes on Windows. Please save on a short debounce (or when the pinch ends) instead. - The new Electron test is skipped in CI, so it never protects the change. It is also large for what it checks: it bundles a helper script into
src/main, starts two Electron processes and relies on 15s/45s timeouts. Please replace it with a small test of the stored-value fallback and clamping (missing, invalid, out of range, valid), or drop it. - Minor: the description says the early window applies the saved zoom to the Windows titlebar overlay, but
early.tsstill callstitlebarOverlay()without a zoom. On Windows the first window's caption buttons use the default height until the renderer callssetTitlebar. PassingstoredZoomFactor()there, aswindowAppearancedoes, would make it consistent.
A Windows/macOS manual check (zoom in, quit fully, relaunch; then turn pinch zoom off and on) would be useful, since I couldn't run the app.
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Adding the Windows verification side of this from #50169, since the bot review above couldn't launch the desktop app anywhere.
On the For reference, my current workaround is |
|
Bumping with a fresh data point: Desktop 2.1.0 (the current release) still resets zoom to 100% after a restart. The reset is still present on This PR is in a mergeable state: no conflicts, bot checks pass, template-compliant, small self-contained change (7 files). Requesting a code-owner review from @Hona and @Brendonovich so it can land before the next release. Happy to adjust anything reviewers want; @wc4440222 has also offered Windows verification if a build is available. |
- coalesce settings writes (250ms) and flush on before-quit - replace the Electron integration test with a pure fallback/clamp test - pass the stored zoom to the early window's titlebar overlay
|
Thanks for the review — all three points are addressed in
I also moved the 0.2–10 range and the fallback rule into I still can't run |
|
Reviewed the new revision ( A few things I'd want addressed before this lands, ordered by how confident I am that they matter on Windows: 1. It runs from a try { ... } catch { /* keep the app alive, losing one zoom write is fine */ }Dropping a zoom value is acceptable; crashing the app from a timer callback is not. 2. Is zoom meant to be global or per-window?
3. Discrete changes should not wait for the debounce
4. The risk moved into the new code, so it needs coverage Removing the Electron integration test was the right call, but the only test left covers 5. Two smaller consistency notes
On testing: I still can't build the desktop app on this machine, so I need an artifact (CI build or a packaged build) to run the Windows EPERM/pinch check — happy to test it against 2.1.2 as the baseline. |
- persist zoom through a coalescing writer: first change immediate, continuous pinch throttled, flush on quit - guard settings writes so a locked settings file cannot crash the main process - use one normalize/clamp policy for restore and runtime - drop the duplicate restore in wireZoom; webPreferences is the single source - document that zoom is an app-wide preference - unit-test the coalescer and normalization
|
Thanks — this is a much better review than the automated one. Addressed in
|
There was a problem hiding this comment.
The new commits address my earlier points. Zoom saves are now coalesced: the first change is saved right away and fast changes at most once per 250 ms, a failed write is caught, and anything pending is saved on before-quit. The Electron test that CI skipped and zoom/native.ts are gone, replaced by small unit tests. The early window's Windows titlebar overlay now uses the saved zoom. I still couldn't run the desktop app here. bun test on the two new test files passes (7 tests), and bun run typecheck in packages/desktop passes.
Public API: unchanged. It only adds an internal zoomFactor key to the desktop settings file, and missing or invalid values fall back to 1.
One new point, inline: createZoomPersister takes test-only options, which packages/desktop/AGENTS.md asks you not to add to production code.
Remove the test-only delay/now/schedule/cancel options from the production module and let the test use real timers, per packages/desktop/AGENTS.md.
There was a problem hiding this comment.
My earlier point is addressed: createZoomPersister no longer takes test-only delay/now/schedule/cancel options. It takes only the write callback and uses the real timer, so it follows packages/desktop/AGENTS.md. The tests now wait on real time; the 400 ms wait comfortably covers the save, which fires after at most 250 ms, so I don't expect them to be flaky. bun test on the two zoom test files passes (7 tests), and bun run typecheck in packages/desktop passes. I still couldn't run the desktop app here, so restart and restore remain unverified by me.
Public API: unchanged. It only adds an internal zoomFactor key to the desktop settings file.
No new concerns.
|
Status update, in case it helps with review: the automated review is complete ( The remaining step is a code-owner review. @Hona @Brendonovich — whenever you have a moment. It's a small, self-contained change (7 files) for a regression that is still present on If this isn't the direction you want for the desktop, say so and I'll close it — otherwise it's ready to merge. No rush on my side; just flagging that the machine review is done so a human glance is the only thing left. |
|
Thanks for working on this, and for the cross-platform testing in the thread. Zoom persistence landed in #59277: Settings → Appearance now has a Zoom select (100–200%), and the chosen level is saved and restored on launch. Keyboard and menu zoom step through the same levels. We went with fixed levels instead of saving any zoom factor, so pinch zoom stays temporary. Closing this in favour of that change. |
Issue for this PR
Closes #50168
Closes #49096
Type of change
What does this PR do?
The desktop resets zoom to 100% every time a window is created:
wireZoomcallssetZoomFactor(1)unconditionally, and no zoom value is ever stored. This stores the chosen factor in the appearance settings, andwireZoom/ the early window /windowAppearancerestore it instead of forcing 1 (clamped to 0.2–10, falling back to 1 for missing or invalid values).setZoomFactorwrites the value, disabling pinch zoom no longer resets the scale, and theWindowSetZoomFactorhandler goes through that same persisting setter, so keyboard, menu and pinch all persist.This is a rebase of #50169 onto current
dev, which no longer merged cleanly. Authorship and the commit message are preserved; the tests were relocated to co-locatedpackages/desktop/src/main/windows/.How did you verify your code works?
Reproduced the reset on Desktop 2.0.32 on macOS arm64; also confirmed on Linux and Windows 11 in #50168. I did not run
bun run checkor the Electron test locally (nobunon this machine), so CI should cover it.Screenshots / recordings
No layout or copy changes.
Checklist