Finish the settings load when the tree remounts mid-load #29

Merged
jcoffey-dev merged 1 commits from fix/settings-sync-remount into main 2026-10-05 03:48:08 +00:00
Owner

AuthedApp read the account's settings file inside an effect that its own
unmount canceled, and claimed the account before it started. A remount
during the load (the settings file choosing a language does it, and so
does StrictMode in dev) canceled the first run halfway, and the second
mount took the already-loaded shortcut, which set ready but never armed
the pushes. Every setting changed afterwards was silently dropped, and
reverted on the next reload or sign-in.

The load now belongs to the account rather than the mount:
loadSettingsOnce starts it once, every mount waits on the same promise,
and it runs to the end, arming pushes when it finishes. A sign-out still
stops it, through a generation check in place of the mount's flag.

Arming in the shortcut, as the report suggested, is not enough on its
own: when the remount comes before the file is read, arming there would
push this browser's settings over the account's.

Verified on the mock with no settings cache: on main the account's
language and theme are never applied in dev and a theme change is never
written; with this change both are. No new strings.

Fixes #23. Reported by @githubrepo.

AuthedApp read the account's settings file inside an effect that its own unmount canceled, and claimed the account before it started. A remount during the load (the settings file choosing a language does it, and so does StrictMode in dev) canceled the first run halfway, and the second mount took the already-loaded shortcut, which set ready but never armed the pushes. Every setting changed afterwards was silently dropped, and reverted on the next reload or sign-in. The load now belongs to the account rather than the mount: loadSettingsOnce starts it once, every mount waits on the same promise, and it runs to the end, arming pushes when it finishes. A sign-out still stops it, through a generation check in place of the mount's flag. Arming in the shortcut, as the report suggested, is not enough on its own: when the remount comes before the file is read, arming there would push this browser's settings over the account's. Verified on the mock with no settings cache: on main the account's language and theme are never applied in dev and a theme change is never written; with this change both are. No new strings. Fixes #23. Reported by @githubrepo.
jcoffey-dev added 1 commit 2026-10-05 03:29:32 +00:00
Finish the settings load when the tree remounts mid-load
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 2m32s
ef33c0b121
AuthedApp read the account's settings file inside an effect that its own
unmount canceled, and claimed the account before it started. A remount
during the load (the settings file choosing a language does it, and so
does StrictMode in dev) canceled the first run halfway, and the second
mount took the already-loaded shortcut, which set ready but never armed
the pushes. Every setting changed afterwards was silently dropped, and
reverted on the next reload or sign-in.

The load now belongs to the account rather than the mount:
loadSettingsOnce starts it once, every mount waits on the same promise,
and it runs to the end, arming pushes when it finishes. A sign-out still
stops it, through a generation check in place of the mount's flag.

Arming in the shortcut, as the report suggested, is not enough on its
own: when the remount comes before the file is read, arming there would
push this browser's settings over the account's.

Verified on the mock with no settings cache: on main the account's
language and theme are never applied in dev and a theme change is never
written; with this change both are. No new strings.

Fixes #23. Reported by @githubrepo.
jcoffey-dev merged commit 5ec06f4012 into main 2026-10-05 03:48:08 +00:00
jcoffey-dev deleted branch fix/settings-sync-remount 2026-10-05 03:48:08 +00:00
Sign in to join this conversation.