Audit React Query usage for best practices — key factories, staleTime, mutations, and server state ownership
Arguments:
User arguments: $ARGUMENTS
This codebase uses React Query (TanStack Query) as the single source of truth for all server state. All query hooks live in hooks/queries/. Zustand is used only for client-only UI state. Server data must never be duplicated into useState or Zustand outside of mutation callbacks that coordinate cross-store state.
Read these before analyzing:
hooks/queries/ must have a hierarchical key factory with an all root keylists, details) for prefix invalidationqueryFn must forward signal for request cancellationstaleTime (default 0 is almost never correct)keepPreviousData / placeholderData only on variable-key queries (where params change), never on static keysenabled to prevent queries from running without required paramsonSettled (not onSuccess) for cache reconciliation — it fires on both success and erroronMutate, roll back in onErrorentityKeys.lists()) not broad (entityKeys.all) when possibleuseCallback deps — .mutate() is stablesetQueryData is for optimistic updates onlystaleTime: Infinity