@reduxjs/toolkit
2.15.0 · 18 Nov 2026MIT51.3M / weekRepositoryHomepagenpmAtom feed
Where each line stands
Plan an upgrade- 2.x2.15.0No known advisoryLatest line
- 1.x1.9.7No known advisoryTo 2.15.0
Latest releases
All 74 releases2.15.0
18 Nov 2026Removing a cache entry while its request runs now aborts that request. This covers
removeQueryResult, a lazy query'sreset(), cache collection, andresetApiState. Theinitiate()promise resolves withisError: trueand anAbortErrorwhose message is'removed'or'reset'. That meansunwrap()now rejects in this case, where it used to resolve with stale or missing data. The plain promise still never rejects.queryFulfilledinonQueryStartedrejects in the same case. If youronQueryStarteddoesawait queryFulfilledwithout atry/catch, you'll now get an unhandled rejection when the entry is removed mid-request. Wrap it:async onQueryStarted(arg, { queryFulfilled }) { try { const { data } = await queryFulfilled // ... } catch { // request failed, or the cache entry was removed while it ran } }Invalidating an entry that has a running request (by tags, or a focus/reconnect refetch) now waits for that request to finish. The running request's promise gets its own result, and then the entry refetches if it has subscribers, or is removed if it doesn't.
This feature release gives each store its own RTK Query middleware runtime, makes
initiate()promises resolve with their own request's result, adds several new options to RTK Query, improves listener middleware fork child capabilities, improves readability for several RTK type definitions, and fixes a variety of RTKQ bugs.This release continues the work from our roadmap to Redux Toolkit 3.0. Several of the RTK Query changes here are bug fixes that change behavior in edge cases, so please read the "Behavior Changes" notes below.
Changelog
Per-Store RTK Query Runtime
RTK Query's middleware keeps a lot of state outside the Redux store in order to manage requests and cache lifetimes: subscriber counts, running requests, poll and cache collection timers, and cache lifecycle promises. That state used to live in closures shared by every store that used the same
apiobject. That was fine for a single client-side store, but caused problems for SSR and tests, where many stores share oneapi.Each store now gets its own consolidated internal runtime state, created by the API middleware.
resetApiStatenow callsruntime.reset(), which clears every subscriber, timer and cache lifecycle for that store, aborts running requests, and clears pending tag invalidations. It no longer touches other stores.Internally, each cache key now has one record that tracks its running request, timers and lifecycle, and all removals go through a single path. That made the
initiate()fixes below possible.The missing-middleware check now runs once per store, and looks for the store's runtime instead of dispatching an internal action. This check is stricter: an api whose middleware is missing now throws even if another api with the same
reducerPathhas its middleware in the store.initiate()Promises Resolve With Their Own ResultWe had several long-standing reports (#5506, #4833, #5173, #5346) that the promise from
initiate()could resolve withundefined, or with a different request's data. That happened when the cache entry was removed, reset, invalidated or replaced while the request was running, because the promise read the cache entry after the request finished instead of the request's own result.We've done a thorough review of the promise resolution logic to analyze the current intended behavior, ran separate formal modeling of the derived behavior to help uncover gaps, updated the model to fill those gaps, and reworked that logic to fully comply with the improved expected behavior.
Each
initiate()promise now resolves with its own request's result, captured as soon as that request'sfulfilledorrejectedaction reaches the store.Behavior Changes
These ship in 2.x as bug fixes, but code that depended on the old behavior will see a difference:
Removing a cache entry while its request runs now aborts that request. This covers
removeQueryResult, a lazy query'sreset(), cache collection, andresetApiState. Theinitiate()promise resolves withisError: trueand anAbortErrorwhose message is'removed'or'reset'. That meansunwrap()now rejects in this case, where it used to resolve with stale or missing data. The plain promise still never rejects.queryFulfilledinonQueryStartedrejects in the same case. If youronQueryStarteddoesawait queryFulfilledwithout atry/catch, you'll now get an unhandled rejection when the entry is removed mid-request. Wrap it:async onQueryStarted(arg, { queryFulfilled }) { try { const { data } = await queryFulfilled // ... } catch { // request failed, or the cache entry was removed while it ran } }Invalidating an entry that has a running request (by tags, or a focus/reconnect refetch) now waits for that request to finish. The running request's promise gets its own result, and then the entry refetches if it has subscribers, or is removed if it doesn't.
A refetch while a request is running joins that request instead of starting another one.
initiate()also joins a runningupsertQueryData.A
pendingentry restored from persisted state, with no request actually running, now fetches again.
onCacheEntryAddedhas a newgetCacheEntryRemovedReason()function that returns'reset'if the entry was removed byresetApiState,'removed'for any other removal, orundefinedwhile the entry is still in the cache.cacheEntryRemovedstays aPromise<void>, since many apps declare that type in their own handler types.async onCacheEntryAdded(arg, { cacheEntryRemoved, getCacheEntryRemovedReason }) { const connection = openConnection(arg) await cacheEntryRemoved if (getCacheEntryRemovedReason() !== 'reset') { connection.unsubscribe() } connection.close() }startReasonfor Query RequestsWe've had a request (#4757) to know why a query is fetching. For example, a
queryFnmight want to read from the primary database after a tag invalidation, instead of a replica that may be behind.baseQuery/queryFn(viaBaseQueryApi),fetchBaseQuery'sprepareHeaders,onQueryStartedandonCacheEntryAddednow receive astartReason. The newQueryStartReasontype is'initial' | 'refetch' | 'invalidation' | 'poll' | 'focus' | 'reconnect' | 'upsert' | 'hydrate' | 'nextPage' | 'previousPage'.const api = createApi({ baseQuery: fetchBaseQuery({ baseUrl: '/api', prepareHeaders: (headers, { startReason }) => { if (startReason === 'invalidation') { headers.set('x-read-from-primary', 'true') } return headers }, }), endpoints: () => ({}), })A few details:
'initial'vs'refetch'depends on whether the entry already has data. Mutations getstartReason: undefined.'hydrate'is reserved for upcoming hydration work and isn't set yet. We may add additional values in the future if needed.Function
pollingIntervalpollingIntervalcan now be a function that receives the current cache entry and returns an interval in ms (#2639). This covers "poll while a job is running, stop when it's done" without a second hook:useGetJobQuery(id, { pollingInterval: ({ data }) => (data?.status === 'running' ? 1000 : 0), })It works in all the query hooks,
initiate()andupdateSubscriptionOptions. The function runs once per cache key when the next poll is scheduled after a request settles. When several subscribers poll the same key, the lowest result wins, the same as numeric intervals. Returning0, a negative number or a non-number means "don't poll", and polling resumes if a later request makes the function return an interval again. An inline function in a hook doesn't dispatchupdateSubscriptionOptionson every render.Related changes:
A negative numeric
pollingIntervalnow means "no polling". Before, it re-polled immediately in a loop.'payload.options.pollingInterval'is a new default entry in the serializability check'signoredActionPaths. If you pass your ownignoredActionPaths, you'll need to add it.SubscriptionOptions['pollingInterval']is nownumber | ((entry) => number), so code that reads it as anumberneeds a type check. There's a new exportedPollingIntervaltype.
getRunningQueryandretainForapi.endpoints.x.getRunningQuery(arg)is a typed thunk for query and infinite query endpoints. Dispatching it returns the promise of the running request for that cache entry, orundefined. It's the same promise theinitiate()call that started the request returned, and awaiting it doesn't add a subscription. It's the typed per-endpoint form ofapi.util.getRunningQueryThunk.Query
initiate()has a newretainForoption, in seconds. After the last subscriber leaves, the entry is kept forMath.max(keepUnusedDataFor, retainFor)seconds. This is useful for prefetching orsubscribe: falserequests whose data will be read soon:dispatch(api.endpoints.getPost.initiate(id, { subscribe: false, retainFor: 60 })) // later const running = dispatch(api.endpoints.getPost.getRunningQuery(id)) if (running) { await running }There's also a new dev-only warning when an infinite query page fetch joins a running fetch in the other direction, like calling
fetchNextPage()whilefetchPreviousPage()is running. The second call still joins and doesn't fetch its own page, same as before.getMiddlewareState()andisSubscribed()The React hooks used to dispatch an internal
internal_getRTKQSubscriptionsaction to check subscription status, and some libraries copied that pattern. We've added real APIs for it:api.util.getMiddlewareState()is a thunk that returns read-only access to what the middleware tracks for that store (currentlygetSubscriptionCount(queryCacheKey)), orundefinedif the middleware isn't added (#5501).Query
initiate()results have anisSubscribed()method.
The hooks use
isSubscribed()now, and don't dispatch anything to check subscriptions. Theinternal_getRTKQSubscriptionsaction is deprecated. It still works in 2.x, but logs a one-time dev warning and will be removed in 3.0. If you maintain a library that dispatches it (such as a port of the RTKQ hooks to another framework), switch togetMiddlewareState()andisSubscribed().The hooks also no longer run their own missing-middleware check. A hook with
skip: trueon a store without the API middleware no longer throws. A non-skipped hook still throws, from the check ininitiate().Listener Middleware: Nested Forks
ForkedTaskAPInow hasgetState,dispatchandfork, so a forked task can read state, dispatch actions and start its own child tasks (#3314). Nested forks are cancelled when the task that forked them ends or is cancelled. A nested fork withautoJoin: truemakes its parent wait for it before completing.listenerMiddleware.startListening({ actionCreator: startSync, effect: async (action, listenerApi) => { listenerApi.fork(async (forkApi) => { const { userId } = forkApi.getState().auth forkApi.fork( async (childApi) => { childApi.dispatch(syncStarted(userId)) }, { autoJoin: true }, ) }) }, })ForkedTaskAPIand the task executor types have optionalStateandDispatchTypegenerics, which flow throughstartListening,addListenerand theirwithTypes()versions. Like the listener's owngetStateanddispatch, these aren't guarded after the task finishes. With some internal cleanup in the same PR, the listener middleware is slightly smaller even with the new API.Readable Editor Hovers
Hovering over RTK and RTKQ types in an editor often showed a wall of text that the editor cut off at 500 characters, along with odd names like
Slice$1andIsAny. We've added named types so hovers show a name instead of the full structure:FetchBaseQueryFn,ApiUtil,ListenerMiddlewareDispatch,AsyncThunkPromiseandReactApiModules. The query, mutation and infinite query selector result types were rewritten so TypeScript keeps their names. Some hover lengths, before and after:Hover Before After useMutationtuple2508 386 endpoints.getPost.select(...)2399 602 api.util16102 471 dispatch(thunk(...))552 71 These are type-only changes. Please let us know if the selector result rewrite causes problems in code that's generic over endpoint definitions.
Refetch and Polling Option Fixes
When several subscribers share a query, RTKQ combines their options. Some of those rules skipped refetches that a subscriber asked for (#5583). Each subscriber's options are now resolved before they're combined:
refetchOnMountOrArgChange: 0andforceRefetch: 0now always refetch. Before,0disabled the option.refetchOnFocusandrefetchOnReconnectrefetch a shared query if any subscriber's own or inherited setting istrue. One subscriber'sfalseno longer turns it off for the others.Polling skips while unfocused only if every polling subscriber sets
skipPollingIfUnfocused. Non-polling subscribers don't affect this.
Other Fixes
An endpoint's
maxRetriesnow caps retries even when the api-levelretry()has aretryCondition. TheretryConditionstill decides which errors retry (thanks @luantaraschi!).retry.fail()called inside abackofffunction no longer nests the error inside{ error, meta }(thanks @dfedoryshchev!).fetchBaseQuery'stimeoutnow works when the request passes its ownsignal(thanks @wozhenbang2004!). Query parameters are now added before a URL#fragmentinstead of after it (thanks @henricop!).FetchArgs.headersnow acceptsnumberandbooleanvalues, which are converted to strings. They already worked at runtime (thanks @emersion!).The entity adapter keeps the
idsorder when an update changes an entity's id (thanks @b84330808!).Wrapping
createSlicein a generic helper now keeps thepreparecallback's parameter types (thanks @kkatalz!).Docs Updates
We've documented
getCacheEntryRemovedReason,startReason,getRunningQuery,retainFor,getMiddlewareState,isSubscribed, functionpollingIntervaland nested forks, and fixed several smaller doc and JSDoc errors.What's Changed
Refactor RTKQ middleware state into a per-store runtime
Give each store its own RTKQ middleware runtime, with
reset()Add
getState,dispatch, andforktoForkedTaskAPIFix public type names shown in editor hovers (
Slice$1,IsAny)Add
api.util.getMiddlewareState()andisSubscribed()on queryinitiate()resultsTrack each cache key's request, timers and lifecycle through record transitions
Resolve
initiate()promises with their own request result, and remove entries through one pathSettle and abort every running request for a key when its entry is removed
Add named public types so editor hovers stay readable
Fix endpoint maxRetries being ignored with a retry() retryCondition
Add
startReasontoBaseQueryApiand query lifecycle APIsAdd
endpoint.getRunningQueryandinitiateretainForoptionAllow
pollingIntervalto be a function of the cache entrytoolkit: Keep
prepareparameter types when wrappingcreateSliceentityAdapter: Keep ids order when an update changes an entity id
toolkit:
fetchBaseQuerytimeouts when a request provides a signalFix refetch defaults and shared polling preferences
toolkit:
retry.fail()in abackofffunction nesting the error in{ error, meta }query: Append query parameters before URL fragments
query: Allow boolean/number in headers
2.14.0
3 Nov 2026- Deprecated
ApiRootStatereplaces RTK Query'sRootStatetype, which is now deprecated.RootStatewill be removed in 3.0. TypedAddListenerActionandTypedRemoveListenerActiondescribe the actions thataddListenerandremoveListeneractually dispatch. The default payload type ofTypedAddListenerandTypedRemoveListeneris now the listener options object, soaddListener.match(action)no longer claimsaction.payloadhas fields likeidandunsubscribethat don't exist at runtime.dispatch(removeListener(...))is typed as returningbooleananddispatch(clearAllListeners())as returningvoid, matching the runtime.
This feature release speeds up the dispatch path and RTK Query's
Apitype checking, shrinkscreateSlicein esbuild bundles, adds RTK-ownedDraftandPatchtypes so emitted declarations no longer reference Immer, addsremoveMany({ where })andselectByIdsto the entity adapter, adds RTK Query cache entry selectors and a DevTools action sanitizer, and fixes a very long list of RTK Query lifecycle, polling, upsert, timer, hook andfetchBaseQuerybugs.Note that we just announced our roadmap to Redux Toolkit 3.0, which includes both a large set of planned 2.x features and improvements, and planned 3.0 breaking changes. The fixes and updates in this release help pave the way for all of those efforts. We'd also appreciate feedback on the linked RTK Query usage patterns and 3.0 planned breaking changes discussion threads.
Changelog
Dispatch Performance
Every dispatched action runs through every reducer and middleware, so small costs on that path add up. We added a benchmark harness for the dispatch path and used it to find several places where RTK did work for actions it didn't care about.
createAction(...).matchnow comparesaction.typebefore callingisAction, so a non-matching action costs a property read.createReducerno longer allocates arrays on every dispatch to collect case and matcher reducers. SincecreateSlicebuilds its reducer withcreateReducer, every slice reducer gets this improvement.The listener middleware used to copy its listener list and call every predicate for every action. It now keeps a snapshot that is rebuilt only when listeners are added or removed, and that snapshot knows which action types have
typeoractionCreatorlisteners. If an action's type isn't in that set and there are nomatcherorpredicatelisteners, the middleware skips the loop entirely.The RTK Query root reducer now returns the existing state for actions that none of its slices handle, instead of running all five slice reducers. It also skips rewriting a query's provided tags when the new tags are the same as the stored ones, so re-fetching a query that returns the same tags no longer creates new
providedstate.Some numbers from the PR benchmarks (Node 26, ops/sec unless noted):
Scenario Before After Listener middleware, 200 listeners, unrelated action 108K 5.34M Listener middleware, 200 actionCreatorlisteners, matching action100K 612K createSlice, 20 slices, unrelated action320K 394K RTKQ store, unrelated action 352K 468K RTKQ re-dispatch of a fulfilled query with unchanged tags, 1000 entries (ms per dispatch) 2.50 0.55 The listener middleware numbers are the biggest change, because the old cost grew with the number of listeners. Apps with a handful of listeners will see much smaller gains.
The RTK Query middleware also does less work keeping the store's
subscriptionsstate in sync (#5499). It used to JSON-copy the whole subscriptions object and diff it with Immer every 500ms while subscriptions were changing. It now records which cache keys changed and writes one patch per key. Keys that didn't change keep their object references, so the Redux DevTools no longer receive a full copy ofsubscriptionson every sync. Polls,refetch()calls and tag invalidation refetches don't add subscribers, so they no longer schedule a sync at all. The visible difference: a cache key that only ever hadsubscribe: falserequests no longer shows up as an empty{}insubscriptions.Smaller
createSliceBundles With esbuildcreateSlicereferencesasyncThunkCreatorso thatcreate.asyncThunkworks in thereducerscallback. esbuild couldn't tell that theasyncThunkCreatorobject was free of side effects, so it always bundledcreateAsyncThunkalong withcreateSlice. webpack already dropped it. We've marked it as pure, and an esbuild bundle that imports onlycreateSliceis now about 1 kB smaller (brotli).Faster RTK Query
ApiType CheckingThe
Apitype combines every registered module (core, React hooks, and any third-party modules) by runningUnionToIntersectionover the module names. TanStack Table hit the same cost with the same design, and found that writing out the known intersection and adding variance annotations helped a lot.We've done the same thing here:
Apiuses the core module type directly, andApiModuleshasin outvariance annotations. On a test app with one ~50-endpointcreateApi, type instantiations dropped 22% and check time dropped about 25% on TS 6, and about 18% on the TS 7 native preview. Third-party modules likengrx-rtk-querysaw 7-8% fewer instantiations. There are no runtime changes.RTK-Owned
DraftandPatchTypesRTK used to re-export Immer's
Drafttype, and used Immer's types in signatures likeCaseReducerandPatchCollection. That meant the.d.tsfiles TypeScript generated for your slices referencedimmer. With a package manager layout whereimmerisn't hoisted, those declarations failed to build with TS2883 (#5516). Re-exporting doesn't fix that, so RTK now declares its ownDraft,WritableDraftandPatchtypes with the same shapes as Immer's. Emitted declarations now point at@reduxjs/toolkitinstead. Our type tests check that RTK'sDraftand Immer'sDraftstay interchangeable, so code that mixescastDraftorcurrentwith RTK's types keeps working. We also bumped theimmerdependency to^11.2.9.There are a few other type additions in this release:
- Deprecated
ApiRootStatereplaces RTK Query'sRootStatetype, which is now deprecated.RootStatewill be removed in 3.0. TypedAddListenerActionandTypedRemoveListenerActiondescribe the actions thataddListenerandremoveListeneractually dispatch. The default payload type ofTypedAddListenerandTypedRemoveListeneris now the listener options object, soaddListener.match(action)no longer claimsaction.payloadhas fields likeidandunsubscribethat don't exist at runtime.dispatch(removeListener(...))is typed as returningbooleananddispatch(clearAllListeners())as returningvoid, matching the runtime.UseQueryStateDefaultResultandUseInfiniteQueryStateDefaultResultare exported from@reduxjs/toolkit/query/react, for wrapping hooks with a genericselectFromResult.
RTK Query Cache Entry Selectors
We've had requests for a way to list everything in the cache for an endpoint (#2995).
api.util.selectEntriesForEndpoint(state, endpointName)returns all cache entries for one query or infinite query endpoint, andapi.util.selectAllQueryEntries(state)returns them for every endpoint. Each item has the entry's fields plus itsqueryCacheKey, and is typed for its endpoint. Both selectors are memoized. There's also a new exportedQueryCacheEntry<Definition>type.const postEntries = api.util.selectEntriesForEndpoint(state, 'getPost') const loadedPostIds = postEntries .filter((entry) => entry.status === 'fulfilled') .map((entry) => entry.originalArgs)
DevTools Action Sanitizer
All RTK Query requests use the same few action types, so the Redux DevTools show a long list of
api/executeQuery/fulfilledactions, and you have to open each one to see which endpoint it was for. The newcreateApiActionSanitizer(api)returns a function for the DevToolsactionSanitizeroption that renames those actions for display, likeapi/executeQuery/fulfilled (getPosts). The dispatched actions aren't modified.import { configureStore } from '@reduxjs/toolkit' import { createApiActionSanitizer } from '@reduxjs/toolkit/query' import { api } from './api' export const store = configureStore({ reducer: { [api.reducerPath]: api.reducer, }, middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware), devTools: { actionSanitizer: createApiActionSanitizer(api), }, })See the
createApiActionSanitizerdocs for combining sanitizers for multiple APIs.Entity Adapter Additions
adapter.removeManynow accepts a{ where }object, and removes every entity whose fields match all the given values (#5524):postsAdapter.removeMany(state, { where: { authorId: 5 } })The match object is typed as
Partial<T>, and values are compared with===. Awhereobject with no keys removes nothing, so a filter built at runtime that ends up empty can't clear the collection by accident. UseremoveAllfor that. There's also a new exportedRemoveManyFilter<T>type.getSelectors()now includesselectByIds(state, ids), which returns the entities for the given ids in the order ofids, skipping ids that don't exist.removeManyis also faster. It used to filter the Immer draft of theidsarray, which reads every element through the draft proxy. It now filters a plain copy against aSetof removed ids.RTK Query Fixes
Lifecycles:
cacheDataLoadednow only resolves for a response from a request that started while that lifecycle was waiting. A late response from before aremoveQueryResultno longer resolves the next lifecycle on the same key with discarded data. Re-triggering a mutation with the samefixedCacheKeynow ends the previousonCacheEntryAddedlifecycle, so itscacheEntryRemovedcleanup runs instead of leaking. If that earlier trigger is still in flight, itscacheDataLoadednow rejects instead of never settling. Thanks to @hamarshehmhmd for the analysis in #5539.getCacheEntry()in a mutation'sonQueryStartednow finds the entry forfixedCacheKeymutations instead of always returninguninitialized.Synchronous throws from
onQueryStartedandonCacheEntryAddedare now caught and logged withconsole.error. Before, a sync throw inonQueryStartedescaped thependingdispatch and failed the request without ever callingqueryFn. We also added a dev warning whenupdateCachedDatais called before the entry has any data, since that call does nothing.Polling: Polling now stops after the last unsubscribe even if the subscription cleanup hasn't run yet (thanks to @LeulTew for the original fix in #5444). A due poll re-reads
skipPollingIfUnfocusedinstead of using the value from when the timer was set, and skips the poll if a request for that entry is already pending.pollingIntervalvalues above 2^31-1 ms are now clamped with a dev warning, since larger values overflowsetTimeoutand fire after 1ms. Removing a cache entry withremoveQueryResultnow stops its poll timer right away, and switching a subscriber to a slowerpollingIntervalnow reschedules the pending poll instead of letting the old, faster one fire once more. We also fixed a stale internal poll record that could blockupdatePollingInterval, andfetchBaseQuerynow clears itstimeouttimer when the request finishes.Upserts: A failed
upsertQueryDataover an existing entry (for example, from aresponseSchemavalidation error) no longer leaves that entry stuck inpending.upsertQueryEntriesnow skips bad entries one at a time instead of failing the whole batch: unknown or mutation endpoint names and throwingprovidesTagscallbacks are skipped, with dev warnings.Timers and multiple stores:
resetApiStatenow clears the subscription sync timer and the state for delayed tag invalidation, so work scheduled before the reset can't fire afterward. AkeepUnusedDataForremoval timer is now cleared when the key gets a new subscriber or is removed withremoveQueryResult, so an old timer can't remove a newer entry for the same key. Repeatedinitiate(arg, { subscribe: false })calls that hit the cache no longer push back thekeepUnusedDataForremoval, which could keep unused data around indefinitely (#4480, thanks @veksa!).setupListenersnow works with more than one store. Before, only the first store got focus and online events.Hooks: A query that failed before it ever got data now reports
isLoading: truewhen it refetches, instead of havingisLoading,isErroranddataall falsy while the request is pending (#4449, thanks @AnimeshPandey!). This undoes a change from 2.2.4 (#4364) that keptisLoadingfalse when a second hook subscribed to an errored entry. If a parent rendersnullwhileisLoadingis true and a child mounts the same query, the parent now unmounts the child on each refetch, and the two can loop. Render the child based ondataorisErrorinstead. Query args containingNaNno longer cause an endless refetch loop when the query errors. This was a regression from 2.9.0, where arg comparison treatedNaNas never equal to itself (#5338, thanks @aagostino31!).fetchNextPage()andfetchPreviousPage()no longer send a request when the infinite query hook's arg isskipToken, andinitiate(skipToken)no longer sends a request for any query or infinite query endpoint (#5028, thanks @haigou-web!).fetchBaseQuery: Anullbody no longer throwsCannot read properties of nullbefore the request is sent (thanks @dfedoryshchev!). An explicitcontent-typeheader is now kept forArrayBuffer, typed array andBlobbodies, which broke presigned S3 and GCS uploads. It's still removed forFormDataand for a JSON content type on a non-JSON body, and that JSON content type check is now case-insensitive (thanks @tad-bit-better!). A customresponseHandlerthat throws or rejects with a falsy value likeundefinednow produces aPARSING_ERROR, instead of being treated as a successful response (#5480, thanks @JunaidAhamed-7777!). Atimeoutthat fires while the response body is being read is now reported asTIMEOUT_ERRORinstead ofPARSING_ERROR(thanks @Gurmehar-git!).Other RTKQ fixes: An overlapping refetch now stays registered as the running query, so later calls join it and aborting it works (thanks @tedy69!). Apps with many
createApimiddlewares could hit a "Maximum call stack size exceeded" error when the middlewares registered themselves on the first query. Registration no longer restarts dispatch from the start of the middleware chain (thanks @PabloJoan!).api.enhanceEndpoints({ endpoints })now logs an error in development when it names an endpoint that doesn't exist, which usually means a typo.RTK Query thunk actions now include
startedTimeStampand a per-storeseqcounter in thefulfilledand rejected-with-value meta, matching the request'spendingaction, so you can tell which request a response belongs to and in what order requests started. Rejections for aborted requests and unhandled errors don't include these fields yet.Other Fixes
The listener middleware's
take(),condition()anddelay()no longer leave their timers running after the listener is cancelled or the action arrives first.The
autoBatchEnhancerraffallback no longer throws acancelAnimationFrameReferenceError in test environments that delete window globals during teardown (thanks @msutkowski!).RTK Query hooks now log a dev warning when they render with a different store than the one they first subscribed to. If you swap the store passed to
<Provider>, give the Provider akeythat changes with the store so the tree remounts.The serializability check middleware now reports a circular reference in state or actions as a non-serializable value, instead of overflowing the stack (thanks @OskarEichler!).
@types/reactis now declared as an optional peer dependency. RTK's React entry points import React types, and with pnpm's isolated linker or a global virtual store, TypeScript couldn't find them and those types becameany(thanks @unrevised6419!).What's Changed
toolkit:
cancelAnimationFrameReferenceError in the autoBatch raf fallbackAdd a dispatch-path benchmark harness
Fix listener
take/delaytimer leak and documentisAnyOfmatcher inferencequery: Keep overlapping refetches in the running query registry
Fix RTK Query polling timer bugs
Speed up
removeManyin the entity adapterFix stuck
pendingafter failedupsertQueryData, and skip badupsertQueryEntriesentriesFix stale
cacheDataLoaded,fixedCacheKey,getCacheEntry, and sync throws in RTKQ lifecyclesFix RTKQ middleware timer cleanup and
setupListenerswith multiple storesSpeed up RTKQ
Apitype checking by writing out the core moduleSpeed up the dispatch path in createAction, createReducer and listener middleware
Skip RTKQ reducer work for unhandled actions and unchanged provided tags
Add removeMany({ where }) and selectByIds to entity adapter
Add startedTimeStamp and per-store seq to all RTKQ thunk meta
Prevent registration of query middleware to restart dispatch from the beginning
End the previous cache lifecycle when a fixedCacheKey mutation is re-triggered
Document keying the Provider when swapping stores, and warn in dev
Add enhanceEndpoints dev warning, query entry selectors, and createApiActionSanitizer
Record RTKQ subscription sync patches directly and stop re-arming on non-subscribing requests
Let esbuild tree-shake createAsyncThunk out of createSlice
Add RTK-owned Draft/Patch types, ApiRootState, listener action types, and hook result types
Stop RTKQ polls when the cache entry is removed, and reschedule for slower intervals
toolkit: Don't treat a
nullbody as jsonifiable infetchBaseQueryReport circular serializable values without overflowing
query: Don't reset
keepUnusedDataForon condition-skipped queriestoolkit: Declare @types/react as an optional peer dependency
Keep explicit content-type for binary bodies in
fetchBaseQuerytoolkit: Preserve falsy response handler errors
toolkit: Report response body timeouts as
TIMEOUT_ERRORtoolkit: Prevent infinite refetch loop when query args contain
NaNFix
isLoadingstayingfalsewhen refetching after an error with no datatoolkit: Respect
skipTokenin infinite query triggers
2.13.0
29 Sep 2026Additional publishing hardening
codegen: Migrate to oazapfts v7
combineSlices: Scope stateProxyMap per instance to prevent cross-instance proxy collisions
This feature release updates our build tooling to TSDown and PNPM, adds official TypeScript 7 support, and includes a long list of bugfixes across RTK Query,
createAsyncThunk,createEntityAdapter, andcombineSlices.Changelog
Build Tooling Updates
We've fully modernizing modernized our build tooling across all of the Redux repos. That included switching from Yarn to PNPM, ESLint to Oxlint, Prettier to Oxfmt, and TSUp to TSDown.
The part that matters for users is that we now build the package with TSDown instead of
tsup. The package layout,exportsdefinitions, and exported APIs are all unchanged from 2.12. We've checked the new build withattw, and verified that CJS and ESM entry points load in both dev and prod builds, and that thelegacy-esmartifacts still target ES2017. The contents of the bundles do look a bit different (smaller CJS artifacts, slightly different helper output in thelegacy-esmfiles). If you see any behavior differences that look build-related, please file an issue!This is also our first release published via the updated PNPM-based workflow, still using NPM Trusted Publishing. We've also added
pkg.pr.newpreviews for every commit, so you can try out a PR build before it's released.Docs Updates
We've shipped a new combined Redux libraries docs site! The core docs site at redux.js.org now contains the docs for all of our libraries: Redux core and usage guides, Redux Toolkit, React Redux, and Reselect. The prior standalone docs sites for RTK, R-R, and Reselect now redirect to their respective sections of the combined docs. We've also done a major cleanup pass on the docs, deduplicating pages that had similarities (like the Next.js or RTK2 migration pages that lived in both the core and RTK docs), and updating outdated content (modernizing example code snippets, deleting dead links, and making RTK and hooks the default patterns shown). The RTK content now lives at redux.js.org/toolkit/ .
TypeScript 7 Support
TS 7.0 (the native Go port) is now out! We fixed the remaining type errors in RTK when checked by TS 7.0 and 7.1, and TS 7.0 is now part of our CI test matrix.
Per our TS support policy of matching DefinitelyTyped's support window, we've also updated our support matrix to TS 5.6+. As always, RTK may still work with earlier versions, but we no longer test against them.
RTK Query Fixes
useQueryState(and thususeQuery) was passing a new inline selector touseSelectoron every render, and also reading the store directly during render. The selector is now memoized, and the direct store read is gone. This also fixes a bug whereisSuccesscould flip fromfalsetotrueon an unrelated re-render while a query was refetching after an error.isSuccessnow correctly staysfalsein that case.datanow reflects cache updates made viaupdateQueryDatawhile a refetch is in flight, instead of showing the previous result.Polling now reads the current cache state when each poll fires, rather than the state at the time the poll was scheduled. This means
skipPollingIfUnfocusedrespects focus loss that happens after scheduling, and polls stop if their cache entry was removed.We fixed a race where a duplicate query request rejected by the thunk condition could cause queued tag invalidations to run too early and be lost, leaving stale data in the cache.
Tags with falsy ids like
0now invalidate and clean up correctly.Lazy query hooks now re-subscribe correctly when effects restart while the hook state is preserved, such as with Fast Refresh or
<Activity>.Infinite queries no longer trigger
onQueryStartedwhen fetching past the end of the list, and the infinite query hook result type now includes the page error flags.fetchBaseQueryonly treats a URL as absolute if it starts with a scheme.We also fixed an error when rehydrating state for an endpoint name that has no definition.
Other Fixes
createAsyncThunkno longer swallows aborts that happen before thependingaction is dispatched, and now correctly setsrejectedWithValuewhenrejectWithValueis called with a falsy payload.createEntityAdapter'ssetAllnow keeps the last item when given duplicate IDs, matchingsetMany. The sorted adapter'supdateManynow merges multiple updates for the same ID before applying them.combineSlicesnow keeps its internal state proxy cache per instance, so multiple combined reducers no longer interfere with each other.The immutability check middleware now handles circular references in state.
The dynamic middleware now caches its composed middleware chains when the list of middleware hasn't changed.
What's Changed
Additional publishing hardening
codegen: Migrate to oazapfts v7
combineSlices: Scope stateProxyMap per instance to prevent cross-instance proxy collisions
entityAdapter: pre-merge same-ID updates in sorted adapter's updateMany
entityAdapter:setAllwith duplicate IDs keeps last occurrence (consistent withsetMany)query: Reflect cache updates in hook data
Don't swallow
createAsyncThunkaborts that happen before pendingSimplify
useRef<T | undefined>(undefined)usages in RTK Query hooksquery: Prevent
onQueryStartedfrom triggering at end-of-listtypes: Fix tsgo (TS 7.0) type errors and re-enable the native-preview CI job
Modernize CI examples
rtk-query: Only treat a url as absolute when it starts with a scheme
Modern Tooling, Part 1: Oxlint
Modern Tooling, Part 2: Oxfmt
Modern Tooling, Part 3: TSDown and TS6
Modern Tooling, Part 4: Vitest type assertions
Modern Tooling, Part 5: PNPM
Modern Tooling, Part 6: TS7
Modern Tooling, Part 7: vendor
remark-typescript-toolsand update to TS7Modern Tooling, Part 8: Vitest 5
Remove redundant RTK Query example projects
Type the reducer builder implementation explicitly for TS 7.1
toolkit: Flag
rejectedWithValuefor falsyrejectWithValuepayloadsCache unchanged dynamic middleware chains
Preserve delayed invalidations after duplicate query rejection
Read current query state when scheduled polls fire
toolkit: Prevent undefined endpoint reference
toolkit: Tag with a falsy id invalidation and cleanup
rtk-query: Add infinite query page error flags to hook result type
Reinstate lazy queries after preserved effects restart
toolkit: Handle circular references in
immutableStateInvariantMiddlewareFix TS7 errors and update TS matrix
Fix unstable selector reference inside of
useQueryStateandisSuccessduring refetch-after-error
Dependency tracking
Know when your own dependencies move
@reduxjs/toolkit published 7 releases in the last 12 months. inlinr folds the routine ones into a line and keeps the few that need you.
Advisories reach you
An email when a critical or high advisory affects a project, before the next install.
Upgrades checked first
Peer ranges, Node, ESM-only and types changes read before you bump.
Only what matters
Majors and breaking notes stay; patches and sibling bumps fold into one line.
Registry facts last checked 18 Nov 2026. Releases and advisories last read 18 Nov 2026.