Checklist
- •Centralize query keys (no hardcoded arrays/strings): prefer
lib/constants/*asQUERY_KEYS. - •Keep request functions typed and small; validate network payloads at boundaries if needed.
- •Invalidate the smallest scope that is correct (avoid blanket invalidation).
- •Show user feedback with toasts (include toast ids).
Patterns
- •Queries:
- •Provide stable keys and stable parameters.
- •Use
selecton the server to keep payloads small.
- •Mutations:
- •Prefer optimistic updates only when rollback is safe and well-scoped.
- •On success, invalidate the exact keys impacted.
Repo references
- •Query provider:
components/query-provider.tsx - •Timer hooks:
hooks/use-timers.ts