wellworn
traps · 2 served

TanStack Query

@tanstack/react-query · latest 5.102.8 · MIT

Client cache for server state with retries, invalidation, infinite queries, and optimistic updates.

symptom and fix
major · >=5.0.0 · published · verified 2026-09-08
Code ported from v4 breaks: onSuccess on useQuery does nothing, cacheTime is unknown, isLoading changed meaning.
v5 takes a single object argument everywhere, renames `cacheTime` to `gcTime`, `useErrorBoundary` to `throwOnError`, and `keepPreviousData` to `placeholderData`, removes the query-level `onSuccess`, `onError` and `onSettled` callbacks, and renames the pending status so `isPending` is what `isLoading` used to mean. The new `isLoading` is `isPending && isFetching`.
evidence
minor · >=5.0.0 · published · verified 2026-09-08
An infinite query throws at runtime because initialPageParam is missing.
v5 made `initialPageParam` required on `useInfiniteQuery` instead of passing `undefined` to the first `queryFn` call. Pass the first page cursor explicitly, and note that server-side queries now default to zero retries, so a flaky upstream fails the render rather than retrying.
evidence

Sorted by severity. Your agent sees the subset that matches the version you have installed: traps(library: "tanstack-query", version: "5.102.8").