Skip to content

fix(settings): always open on Account section, drop cross-session state - #265

Merged
h4yfans merged 1 commit into
mainfrom
distracted-heyrovsky-97ce9a
Apr 17, 2026
Merged

fix(settings): always open on Account section, drop cross-session state#265
h4yfans merged 1 commit into
mainfrom
distracted-heyrovsky-97ce9a

Conversation

@h4yfans

@h4yfans h4yfans commented Apr 17, 2026

Copy link
Copy Markdown
Collaborator

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 localStorage under memry_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

  • Lifted activeSection state from <SettingsPage> into SettingsModalProvider so the context owns it.
  • open(section?) now resets activeSection to section ?? 'account' on every invocation. Existing deep-link callers (openSettings('ai'), openSettings('journal'), openSettings('account')) keep working because an explicit section still wins.
  • Deleted the localStorage read/write in settings.tsx and the synthetic StorageEvent dispatch in the context — both were only needed to sync state between the two components when the child owned it.
  • Exported a SettingsSection union type from the context so the child no longer needs its own copy.

Radix <Dialog> already unmounts <SettingsPage> on close, so context state + fresh open() call gives us the "reset to Account" behavior cleanly, without needing a useEffect to reset on close.

Type

  • fix — bug fix

Test plan

  • Manual testing: opened Settings, switched to Editor, closed, reopened → lands on Account. Relaunched app → still lands on Account. Triggered openSettings('ai') from the capture input (AI-not-configured flow) → lands on AI Assistant as before.
  • pnpm typecheck:web clean.
  • Unit tests — not added; behavior is a single state source in the context and exercised via manual QA.

Checklist

  • Self-reviewed the diff
  • No hardcoded secrets or credentials
  • Files stay under ~500 LOC
  • Follows immutable data patterns

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.
@h4yfans
h4yfans merged commit 5d2117e into main Apr 17, 2026
5 checks passed
@h4yfans
h4yfans deleted the distracted-heyrovsky-97ce9a branch May 6, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant