fix(updater): open the release-notes tab in the background - #1898
Merged
Conversation
…als focus A surfaced release opens its notes tab in the foreground. Only the active tab is mounted, so the template the user is writing unmounts and the 800ms debounced template save is cleared without ever running. Three failing assertions: the opener passes no open options, the release-notes tab takes aria-current from the template tab, and updateTemplate is never called with the typed body.
The release poller opened the notes tab in the foreground. Only the active tab is mounted, so the surfaced update unmounted whatever the user was writing. For a template that meant the 800ms debounced save was cleared before it ran and the body was never written, leaving the name-only row the user found on reopening. openTab already forwards a background option to the reducer; the opener just never passed it.
This was referenced Aug 30, 2026
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
h4yfans
marked this pull request as ready for review
August 30, 2026 18:11
This was referenced Aug 30, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was broken
A customer on v2026-08-23.2 (Win32) lost a template body: "As I was creating a Template I received an update notice, which resulted in my template being lost because the update note took its place. I was able to get my template tab back, but all my work was gone so it was just the title of the template."
Root cause
UpdateReleaseNotesTabOpeneropens the release-notes tab the moment a release surfaces, and it passed no open options.OPEN_TABtherefore took the foreground branch and made the new tab active.TabPanemounts only the active tab (tab-pane.tsx:57rendersactiveTabalone), so the template editor unmounted mid-edit. Its body lives in component state behind an 800ms debounced save whose cleanup is a bareclearTimeout, so the pending write was discarded and the template kept only the name written when Create was pressed. That is exactly the title-only row the customer found. Introduced by #817.What changed
The opener now passes
{ background: true }.openTabalready forwarded that flag and the reducer already honoured it on every branch; the caller simply never set it. An automatic, non-user-initiated tab no longer takes focus. The two other automatic-lookingopenTabcallers (use-reminder-notifications) are both driven by a real click, so they are untouched.Verification
Unit,
apps/desktop/src/renderer/src/components/updater/update-release-notes-tab-focus.test.tsx, driving the realTabProvider, the real reducer and the realuseTemplateDraftrather than a mockeduseTabs. Committed failing first, then the fix.Before the fix, 3 failed / 3 passed:
After:
Test Files 5 passed (5) / Tests 27 passed (27).E2E,
apps/desktop/tests/e2e/update-notice-tab-focus.e2e.ts, on the real path. It creates a template through Settings, types a body, then broadcasts adownloadingrelease from the main process onupdater:state-changed(the silent auto-download phase, which is not promptable, so no modal covers the app). No test-only production code was added.Without the fix the spec fails on the focus assertion, and a probe on the same build showed the persisted body was
""while the editor had unmounted:With the fix,
1 passed, asserting the release-notes tab is present butaria-selected="false", the template tab is still the active tab, and the persisted template body contains the typed text.Also green:
pnpm lint(0 errors),pnpm typecheck(19/19),pnpm check:architecture,git diff --check,pnpm docs:impact --strict(covered).pnpm --filter @memry/desktop test:rendererreportsnotes-tree-folder-rename-duplicate.test.tsxfailing on timeouts; it passes 14/14 in isolation, reproduces on cleanorigin/mainin a separate worktree, and is machine load from several worktrees running at once, not this diff.Not fixed here
Two latent defects this change does not address, deliberately kept out of scope:
use-template-draft.ts:168-178clears its debounce on unmount without flushing, so up to 800ms of template edits are still lost on any ordinary tab switch.use-editor-teardown.ts:72-91defers thebeforeDestroymarkdown flush into aqueueMicrotask, so it runs after the owning component has already unmounted.Both get their own issues.