fix(settings): always open on Account section, drop cross-session state - #265
Merged
Conversation
Settings page persisted its active section to localStorage, so reopening
(or relaunching) the app returned to wherever the user left off. Lift
activeSection into SettingsModalProvider and reset to 'account' on every
open(), while still honoring explicit deep-links like open('ai'). Remove
the localStorage read/write and the synthetic StorageEvent dispatch used
to sync the previous two-component state.
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
Settings modal now always opens on the Account section, and the active section no longer survives close/reopen or app restart.
Why
The active settings section was persisted to
localStorageundermemry_settings_section, so if a user left the modal on e.g. Editor, that's where the modal reopened next time — even after relaunching the app. The requirement is that Account is the default entry point every time settings opens.How
activeSectionstate from<SettingsPage>intoSettingsModalProviderso the context owns it.open(section?)now resetsactiveSectiontosection ?? 'account'on every invocation. Existing deep-link callers (openSettings('ai'),openSettings('journal'),openSettings('account')) keep working because an explicit section still wins.localStorageread/write insettings.tsxand the syntheticStorageEventdispatch in the context — both were only needed to sync state between the two components when the child owned it.SettingsSectionunion type from the context so the child no longer needs its own copy.Radix
<Dialog>already unmounts<SettingsPage>on close, so context state + freshopen()call gives us the "reset to Account" behavior cleanly, without needing auseEffectto reset on close.Type
fix— bug fixTest plan
openSettings('ai')from the capture input (AI-not-configured flow) → lands on AI Assistant as before.pnpm typecheck:webclean.Checklist