Setup
App.tsx
The hooks
src/fd/hooks.ts
Domain hooks (illustrative)
src/fd/hooks/events.ts
src/fd/hooks/wave.ts
Usage
The mutation pattern for the Wave wizard
sync.mutate to abort the previous in-flight call —
React Query’s useMutation doesn’t do this by default. See
Campaigns Lifecycle.
Caveats
Query keys must include partnerId when multi-partner
Query keys must include partnerId when multi-partner
If a user can switch between partners, encode
partnerId in every
query key (e.g. [partnerId, path, params]) — otherwise switching
partners shows stale cached data from the previous tenant.`refetchInterval` returning `false` stops polling
`refetchInterval` returning `false` stops polling
Use the function signature with
data to compute interval per fetch.Invalidation lists must match query keys exactly
Invalidation lists must match query keys exactly
React Query invalidation is prefix-match.
qc.invalidateQueries({ queryKey: ["/events/"] })
invalidates everything starting with /events/. That’s usually what
you want — but be aware of the scope.