Skip to content

Epic: API modules + TanStack Router/Query adoption #51

Description

@chiptus

Tracking epic for the data-layer refactor planned in docs/HANDOFF_TANSTACK_ROUTER_QUERY.md (refined in a grilling session; see docs/adr/0001-api-modules.md).

Goal

Move from src/hooks/queries/ to a feature-sliced src/api/ module with one self-contained file per endpoint (types + fetch/mutate + queryOptions factory + hook), then adopt TanStack Router loaders + useSuspenseQuery, then make auth-dependent queries prefetchable.

Phases (child tickets)

Each effort is executed feature-by-feature and the three are kept separate (don't bundle a restructure and a router change in one slice).

Key decisions (locked)

  • src/api/, flat — one folder per feature; nested sub-features promoted to top-level siblings (editions, artist-notes, invites).
  • Per feature: shared types.ts (entity Row type + key factory); one use-prefixed file per endpoint holding its types + fetch/mutate + per-file queryOptions factory + hook.
  • enabled/conditional queries stay useQuery (not suspense).
  • Auth: router resolves the session independently, AuthProvider stays fully intact (Hoist auth session into router context (enable auth-dependent loader prefetch) #50).

See the handoff doc for full detail, caveats, and open questions (staleTime, errorComponent global vs per-route).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions