Back from a group returns to your own mail (#133) #137

Merged
jcoffey-dev merged 1 commits from fix/back-to-main-account into main 2026-11-20 22:47:41 +00:00
Owner

Fixes #133. Reported on the forum (t/232, post 40).

After #129, switching accounts replaced the page, so Back from a group had nothing to return to and closed the installed app.

What changes

  • Every page the app adds to the history records the account it was showing (history.state, written in the router's aroundNav, which links, redirects and navigate() all pass through).
  • Switching accounts adds a page again. Back or Forward onto a page that showed another account switches to it. From a group, Back goes to your own mail first, then out of the app.
  • A page with no record, such as the one the app opened on, means your own account. So does a page whose account is gone since.
  • While a message is being written, the account stays, as with the switch in the menu.

Order matters. The account has to change before the router renders the new address. Otherwise the mail view looks for one account's folder in the other's list and says the folder no longer exists. Listeners on window run in the order they were added, and capture doesn't change that (checked in headless Chromium), so lib/accountHistory adds its listener when the module loads, before the router's.

Tests: 11 new in lib/__tests__/accountHistory.test.ts. Full suite 1632 passing; typecheck, build and i18n:check clean. Not tried against a live server in a browser.

Fixes #133. Reported on the forum (t/232, post 40). After #129, switching accounts replaced the page, so Back from a group had nothing to return to and closed the installed app. **What changes** - Every page the app adds to the history records the account it was showing (`history.state`, written in the router's `aroundNav`, which links, redirects and `navigate()` all pass through). - Switching accounts adds a page again. Back or Forward onto a page that showed another account switches to it. From a group, Back goes to your own mail first, then out of the app. - A page with no record, such as the one the app opened on, means your own account. So does a page whose account is gone since. - While a message is being written, the account stays, as with the switch in the menu. **Order matters.** The account has to change before the router renders the new address. Otherwise the mail view looks for one account's folder in the other's list and says the folder no longer exists. Listeners on `window` run in the order they were added, and capture doesn't change that (checked in headless Chromium), so `lib/accountHistory` adds its listener when the module loads, before the router's. **Tests:** 11 new in `lib/__tests__/accountHistory.test.ts`. Full suite 1632 passing; typecheck, build and i18n:check clean. Not tried against a live server in a browser.
jcoffey-dev added this to the 27.1 milestone 2026-11-20 22:45:39 +00:00
jcoffey-dev added 1 commit 2026-11-20 22:45:39 +00:00
Back from a group returns to your own mail (#133)
ci / node (pull_request) Skipped
ci / version (pull_request) Skipped
ci / docker-build (pull_request) Skipped
ci / publish (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 2m7s
ci / announce (pull_request) Skipped
0361c853e0
The account in view isn't part of the address, so after #129 an account
switch replaced the page and left nothing to go back to: in the installed
app, Back from a group closed the app.

Each page the app puts in the history now carries the account it was
showing (history.state, written in the router's aroundNav, which every
link, redirect and navigate() passes through). A switch pushes a page
again, and Back or Forward onto a page that showed another account
switches to it; from a group, Back goes to your own mail first, then out
of the app. A page with no mark, such as the one the app opened on, is
your own account; one whose account is gone since falls back to it.
While a message is being written the account stays, as for the switch
in the menu.

The listener goes in when lib/accountHistory loads, ahead of the
router's: listeners on window run in the order they were added (checked
in Chromium; capture doesn't change it), and the account has to change
before the new address renders, or the mail view looks up one account's
folder in the other's list and says it no longer exists.

Reported on the forum (t/232, post 40).

Fixes #133
jcoffey-dev merged commit a852654e6b into main 2026-11-20 22:47:40 +00:00
jcoffey-dev deleted branch fix/back-to-main-account 2026-11-20 22:47:41 +00:00
Sign in to join this conversation.