npm / @reduxjs/toolkit
@reduxjs/toolkit
What changed in @reduxjs/toolkit 2, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-18.
5 breaking4 new APIs and options1 performance4 behavior and defaults32 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@reduxjs/toolkit 246 changes
Breaking changes 5
Aborts that happen before the pending action is dispatched are no longer swallowed.
RTK now uses TypeScript's built-in NoInfer utility, which is available with TypeScript 5.4 and later.
RTK calls setUseStrictIteration(false), so Immer copies only string keys in objects by default for RTK updates, improving performance; apps using symbol keys can call setUseStrictIteration(true) to restore the previous behavior.
Initiates requests without adding a subscription, so cache entries remain only for the keepUnusedDataFor period unless the app subscribes.
Dispatching resetApiState now aborts all in-flight requests.
New APIs and options 4
The infinite query hook result type now includes the page error flags.
RTK Query hook options types are exported for reuse, so you no longer need to extract them with Parameters.
The RTK package now includes agent skill files for using and migrating to modern RTK, managing client and server state, and handling side effects.
Adds an option for infinite queries that, when false, refetches only the first cached page and shrinks the cache from N pages to 1.
Performance 1
Composed middleware chains are cached when the middleware list has not changed.
Behavior and default changes 4
The sorted adapter merges multiple updates for the same ID before applying them.
Listener middleware matcher types now accept interface-based type guards as well as type-based definitions.
Sets the accept header based on the selected responseHandler, choosing JSON or text.
Stops retrying when the request's AbortSignal is aborted.
Fixes and other changes 32
Its internal state proxy cache is now scoped per instance, preventing multiple combined reducers from interfering with each other.
rejectedWithValue is now set correctly when rejectWithValue is called with a falsy payload.
setAll keeps the last item when given duplicate IDs, matching setMany.
A URL is treated as absolute only when it starts with a scheme.
The middleware now handles circular references in state.
Fetching past the end of an infinite query list no longer triggers onQueryStarted.
Lazy query hooks now re-subscribe when effects restart while hook state is preserved, such as with Fast Refresh or Activity.
Polling checks current cache state when each poll fires, so focus loss after scheduling is respected and polling stops if the cache entry was removed.
Rehydrating state no longer errors when an endpoint name has no definition.
Tags with falsy IDs, such as 0, now invalidate and clean up correctly.
Queued tag invalidations are no longer run too early and lost when a duplicate query request is rejected by the thunk condition.
RTK now supports TypeScript 7.0 and 7.1. The tested support matrix is TypeScript 5.6+.
data now reflects updateQueryData cache changes made while a refetch is in flight.
isSuccess now stays false during an unrelated re-render while a query is refetching after an error.
The enhancer's requestAnimationFrame timer now has a 100ms timeout fallback so updates flush when rAF does not work in background tabs or opened windows.
The isSuccess status flag stays true when switching infinite query cache entries, preventing accidental UI flashes.
AbortSignal handling falls back to a plain Error when DOMException is unavailable, including in React Native environments.
The type now correctly includes the fetchNextPage and fetchPreviousPage fields.
Reworked AbortController handling to avoid an error in a rare case involving resetApiState and retry().
Fixes the immutability development middleware so regex values in ignoredPaths are tested as regexes rather than treated as strings.
Fixes an issue where byte-shaving work in 2.10 caused window access to break in SSR.
Improves type inference when PreloadedState might not match the incoming type, such as with persisted values.
Fixes the calculation of whether a request is active when checking for cache entry cleanup.
Does not set the content-type header for non-JSONifiable request bodies such as FormData, allowing the browser to set it.
Returns unknown errors as {error} instead of rethrowing them, as a base query is supposed to.
Respects maxRetries when retrying after unknown errors, as it already did for known errors.
Internal subscription data is per-store again, preventing subscription IDs from appearing across SSR requests.
Initiates requests without adding a subscription, so cache entries remain only for the keepUnusedDataFor period unless the app subscribes.
Sorted entity adapters now keep the first occurrence when addMany receives duplicate IDs.
RTK Query types ensure data is non-undefined when isSuccess is true, including with exactOptionalPropertyTypes.
clearListeners can cancel effects that have become unsubscribed.
Sorted entity adapters now keep only unique IDs in state.ids when setMany receives duplicate IDs.