Open
Labels
Breaking ChangeContains breaking changesRTK-QueryIssues related to Redux-Toolkit-QueryTypeScriptIssues related to TypeScript.ws-createapiRTKQ createApi structure and extensions
Milestone
Description
Part of #5491.
In 3.0, endpoint definitions get two renames. request: replaces query:, so the option no longer shares a name with build.query. build.query.fn() (and the mutation and infinite query equivalents) replaces the queryFn option.
endpoints: (build) => ({
getPost: build.query<Post, number>({ request: (id) => `/posts/${id}` }),
getLocal: build.query.fn<Settings, void>({ queryFn: () => ({ data: readSettings() }) }),
})Endpoint definitions are plain objects. We keep a separate .fn creator because folding queryFn into request costs noticeably more type instantiations. The creators must not fix the required generics early, so explicit <Result, Arg> still works. Lifecycle names stay onQueryStarted and queryFulfilled.
Tasks:
-
request:for queries, mutations and infinite queries -
.fn()creators - Codegen v3 emits the new form
- Migration rule in the v3 ESLint plugin
Metadata
Metadata
Assignees
Labels
Breaking ChangeContains breaking changesRTK-QueryIssues related to Redux-Toolkit-QueryTypeScriptIssues related to TypeScript.ws-createapiRTKQ createApi structure and extensions
Activity
createApistructure and extensions #5491elijahrdorman commentedon Nov 1, 2026
It seems nicer to me to reverse the naming change to the parent (and build.request sounds quite natural to me).
markerikson commentedon Nov 1, 2026
@elijahrdorman mmm... that feels like it has much larger naming implications and ripple effects. That would also imply changing to
useGetTodosRequest, rewriting all the docs about "queries", etc.I'm okay with renaming a single field even if it's fairly commonly used, I don't want to go renaming core concepts of the library.
EskiMojo14 commentedon Nov 1, 2026
there's also an established distinction even outside this library between queries and mutations, both of which are requests, and each has different semantics. the point of changing the query field here is that it was slightly confusing for mutations to still have a "query"