Skip to content

Commit ef73a90

Browse files
committed
Rename to upsertQueryEntries and entry field arg
1 parent ce7050f commit ef73a90

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

packages/toolkit/src/query/core/buildSlice.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export type NormalizedQueryUpsertEntry<
6363
EndpointName extends QueryKeys<Definitions>,
6464
> = {
6565
endpointName: EndpointName
66-
args: QueryArgFrom<Definitions[EndpointName]>
66+
arg: QueryArgFrom<Definitions[EndpointName]>
6767
value: ResultTypeFrom<Definitions[EndpointName]>
6868
}
6969

@@ -72,8 +72,8 @@ export type NormalizedQueryUpsertEntry<
7272
*/
7373
type NormalizedQueryUpsertEntryPayload = {
7474
endpointName: string
75-
args: any
76-
value: any
75+
arg: unknown
76+
value: unknown
7777
}
7878

7979
export type ProcessedQueryUpsertEntry = {
@@ -313,14 +313,14 @@ export function buildSlice({
313313
prepare: (payload: NormalizedQueryUpsertEntryPayload[]) => {
314314
const queryDescriptions: ProcessedQueryUpsertEntry[] = payload.map(
315315
(entry) => {
316-
const { endpointName, args, value } = entry
316+
const { endpointName, arg, value } = entry
317317
const endpointDefinition = definitions[endpointName]
318318
const queryDescription: QueryThunkArg = {
319319
type: 'query',
320320
endpointName: endpointName,
321-
originalArgs: entry.args,
321+
originalArgs: entry.arg,
322322
queryCacheKey: serializeQueryArgs({
323-
queryArgs: args,
323+
queryArgs: arg,
324324
endpointDefinition,
325325
endpointName,
326326
}),

packages/toolkit/src/query/core/module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ export interface ApiModules<
321321
*/
322322
resetApiState: SliceActions['resetApiState']
323323

324-
upsertEntries: UpsertEntries<Definitions>
324+
upsertQueryEntries: UpsertEntries<Definitions>
325325

326326
/**
327327
* A Redux action creator that can be used to manually invalidate cache tags for [automated re-fetching](../../usage/automated-refetching.mdx).
@@ -549,7 +549,7 @@ export const coreModule = ({
549549
upsertQueryData,
550550
prefetch,
551551
resetApiState: sliceActions.resetApiState,
552-
upsertEntries: sliceActions.cacheEntriesUpserted as any,
552+
upsertQueryEntries: sliceActions.cacheEntriesUpserted as any,
553553
})
554554
safeAssign(api.internalActions, sliceActions)
555555

packages/toolkit/src/query/tests/optimisticUpserts.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ describe('upsertQueryData', () => {
345345
})
346346
})
347347

348-
describe('upsertEntries', () => {
348+
describe('upsertQueryEntries', () => {
349349
const posts: Post[] = [
350350
{
351351
id: '1',
@@ -364,15 +364,15 @@ describe('upsertEntries', () => {
364364
},
365365
]
366366

367-
const entriesAction = api.util.upsertEntries([
367+
const entriesAction = api.util.upsertQueryEntries([
368368
{
369369
endpointName: 'getPosts',
370-
args: undefined,
370+
arg: undefined,
371371
value: posts,
372372
},
373373
...posts.map((post) => ({
374374
endpointName: 'postWithSideEffect' as const,
375-
args: post.id,
375+
arg: post.id,
376376
value: post,
377377
})),
378378
])

0 commit comments

Comments
 (0)