Blog

TanStack Query: defaultQueryClient fetch options, CORS credentials, and mutation retries on 401

Set `credentials: 'include'` at the query client level so every query and mutation inherits consistent CORS behavior.

1 min read
react-querytanstackcors

Devtools

TanStack Query Devtools issues introspection requests—ensure localhost is allowed in dev CORS policies.

Prefetching during navigation can double preflight volume—monitor ratios in production RUM.

Persisters

Persisting cache to localStorage does not bypass CORS on refetch—treat persisted data as stale after auth changes.

Encrypted persisters still need secure origins for subsequent network calls.

Back to blog