Skip to content

feat(ui): let visitors swap the welcome survey storage live - #16

Merged
arnaud-zg merged 1 commit into
feat/catalog-expansion-v2from
feat/dev-settings-storage-switch
Sep 2, 2026
Merged

arnaud-zg merged 1 commit into
feat/catalog-expansion-v2from
feat/dev-settings-storage-switch

Conversation

@arnaud-zg

Copy link
Copy Markdown
Owner

Stacked on #15.

Summary

  • there's exactly one real Strategy-pattern swap point in this app today: the welcome
    survey's storage, with three interchangeable implementations (Local Storage, TanStack
    Store, Zustand) already sitting behind WelcomeStorageRepository. Everything else
    (CourierPolicy, TaxPolicy, the currency formatter) has a single implementation,
    and theme/locale are already user-facing switches
  • a gear icon in the header opens a settings modal to pick the implementation live, no
    rebuild needed
  • useWelcomeModalSurvey now resolves its repository from a small DevSettingsContext
    instead of a hardcoded import, recreating it whenever the selection changes
  • split storage.config.ts's key/type/default out into its own file and lazy-load the
    settings modal, so the provider (which now wraps every route) doesn't drag zustand,
    TanStack Store and zod into the home page's bundle just to hold a string
flowchart LR
  A[gear icon] --> B[pick an implementation]
  B --> C[useWelcomeModalSurvey resolves it]
  C --> D[Local Storage]
  C --> E[TanStack Store]
  C --> F[Zustand]
Loading

Test plan

  • pnpm typecheck
  • pnpm check
  • pnpm lint:md
  • pnpm test:coverage, 25 files, 128 tests, thresholds pass
  • pnpm build, confirmed the home page no longer references the storage.config
    chunk (the modal loads it lazily on demand)
  • pnpm test:e2e
  • new specs: context default/persist/read-back, the modal's radio list, and a live
    switch test (Local Storage keeps TanStack Store's data since both read the same key,
    Zustand persists through its own envelope, provably a different format)

🤖 Generated with Claude Code

https://claude.ai/code/session_014BcGPRc3sgUJYKihGRXh5g

@arnaud-zg
arnaud-zg force-pushed the feat/dev-settings-storage-switch branch from 5657fdd to 541bbfa Compare September 2, 2026 09:58
@arnaud-zg arnaud-zg self-assigned this Sep 2, 2026
@arnaud-zg arnaud-zg added the enhancement New feature or request label Sep 2, 2026
The repo already had three interchangeable WelcomeStorageRepository
implementations (Local Storage, TanStack Store, Zustand), but picking one
meant editing storage.config.ts and rebuilding. That's the only real
Strategy-pattern swap point in the app right now: CourierPolicy, TaxPolicy
and GoldSilverCopperFormatter each have a single implementation, and theme
and locale are already user-facing.

Added a gear icon in the header that opens a settings modal to pick the
implementation live, no rebuild. useWelcomeModalSurvey now resolves its
repository from a small DevSettingsContext instead of a hardcoded import,
recreating it (and resubscribing) whenever the selection changes.

Splitting storage.config.ts's key/type/default from its actual factories
(new welcomeSurveyStorageKeys.ts) and lazy-loading the modal itself keeps
DevSettingsProvider, which now wraps every route via the root layout, from
pulling zustand, TanStack Store and zod into the home page's bundle just to
hold a string in state.

## Test plan
- pnpm typecheck
- pnpm check
- pnpm lint:md
- pnpm test:coverage, 25 files, 128 tests, thresholds pass
- pnpm build, confirmed the home page bundle no longer references the
  storage.config chunk (dev settings modal loads it lazily on demand)
- pnpm test:e2e
- new specs cover: the context's default/persist/read-back behavior, the
  modal's radio list, and switching live between Local Storage and TanStack
  Store (same data, since both read the same key) versus Zustand (its own
  persist-middleware envelope, provably a different format)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014BcGPRc3sgUJYKihGRXh5g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant