Skip to content

refactor(schemacache): move useSchemaCache from hooks to stores (closes #447) - #475

Open
EVWorth wants to merge 1 commit into
mainfrom
fix/447-schemacache-store-convention
Open

refactor(schemacache): move useSchemaCache from hooks to stores (closes #447)#475
EVWorth wants to merge 1 commit into
mainfrom
fix/447-schemacache-store-convention

Conversation

@EVWorth

@EVWorth EVWorth commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

The Zustand store for the schema cache lived in src/hooks/ — a convention smell that hid it from grep src/stores and made new contributors miss it (the other 8 stores all live under src/stores/).

Mechanical rename:

  • src/hooks/useSchemaCache.tssrc/stores/schemaCacheStore.ts
  • src/hooks/__tests__/useSchemaCache.test.tssrc/stores/__tests__/schemaCacheStore.test.ts
  • Export renamed useSchemaCacheuseSchemaCacheStore (Zustand store convention)

All 8 consumers (3 prod, 5 test mocks) updated to the new path and name.

Files

  • src/stores/schemaCacheStore.ts (moved + renamed)
  • src/stores/tests/schemaCacheStore.test.ts (moved + renamed)
  • src/components/editor/QueryToolbar.tsx
  • src/components/editor/SQLEditor.tsx
  • src/components/layout/AppLayout.tsx
  • src/components/editor/tests/QueryToolbar.test.tsx
  • src/components/editor/tests/SQLEditor.test.tsx
  • src/components/editor/tests/SQLEditor.browser.test.tsx
  • src/components/layout/tests/AppLayout.test.tsx
  • src/components/layout/tests/AppLayout.browser.test.tsx

Test plan

  • vitest: full frontend 1538/1538 pass (no behavior change)
  • tsc --noEmit clean
  • eslint clean (pre-existing warnings only)

Closes #447

#447)

The Zustand store for the schema cache lived in src/hooks/ — a convention
smell that hid it from `grep src/stores` and confused new contributors
expecting the project's store layout (editorStore, connectionStore, etc.
all live under src/stores/).

Moves:
- src/hooks/useSchemaCache.ts → src/stores/schemaCacheStore.ts
- src/hooks/__tests__/useSchemaCache.test.ts → src/stores/__tests__/schemaCacheStore.test.ts
- Renames export useSchemaCache → useSchemaCacheStore (Zustand store
  convention)

Updates all 8 consumers (3 prod, 5 test mocks) to import the new path
and name. Verified:
- vitest 1538/1538 pass (no behavior change)
- tsc --noEmit clean
- eslint clean (pre-existing warnings only)

Closes #447

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

[P1][arch] useSchemaCache lives in src/hooks/ but exports a Zustand store — convention drift

1 participant