Skip to content

Commit d4e95ca

Browse files
authored
Merge pull request #1910 from bever1337/dev/bever1337/1904
2 parents daf7df6 + 20fd4d8 commit d4e95ca

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

packages/toolkit/src/query/core/buildMiddleware/invalidationByTags.ts

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export const build: SubMiddlewareBuilder = ({
4747
undefined,
4848
undefined,
4949
undefined,
50+
undefined,
5051
assertTagType
5152
),
5253
mwApi

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

+1
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,7 @@ export function calculateProvidedByThunk(
513513
isFulfilled(action) ? action.payload : undefined,
514514
isRejectedWithValue(action) ? action.payload : undefined,
515515
action.meta.arg.originalArgs,
516+
action.meta,
516517
assertTagType
517518
)
518519
}

packages/toolkit/src/query/endpointDefinitions.ts

+20-9
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,13 @@ export type GetResultDescriptionFn<
147147
TagTypes extends string,
148148
ResultType,
149149
QueryArg,
150-
ErrorType
150+
ErrorType,
151+
MetaType
151152
> = (
152153
result: ResultType | undefined,
153154
error: ErrorType | undefined,
154-
arg: QueryArg
155+
arg: QueryArg,
156+
meta: MetaType
155157
) => ReadonlyArray<TagDescription<TagTypes>>
156158

157159
export type FullTagDescription<TagType> = {
@@ -163,10 +165,11 @@ export type ResultDescription<
163165
TagTypes extends string,
164166
ResultType,
165167
QueryArg,
166-
ErrorType
168+
ErrorType,
169+
MetaType
167170
> =
168171
| ReadonlyArray<TagDescription<TagTypes>>
169-
| GetResultDescriptionFn<TagTypes, ResultType, QueryArg, ErrorType>
172+
| GetResultDescriptionFn<TagTypes, ResultType, QueryArg, ErrorType, MetaType>
170173

171174
/** @deprecated please use `onQueryStarted` instead */
172175
export interface QueryApi<ReducerPath extends string, Context extends {}> {
@@ -236,7 +239,8 @@ export interface QueryExtraOptions<
236239
TagTypes,
237240
ResultType,
238241
QueryArg,
239-
BaseQueryError<BaseQuery>
242+
BaseQueryError<BaseQuery>,
243+
BaseQueryMeta<BaseQuery>
240244
>
241245
/**
242246
* Not to be used. A query should not invalidate tags in the cache.
@@ -310,7 +314,8 @@ export interface MutationExtraOptions<
310314
TagTypes,
311315
ResultType,
312316
QueryArg,
313-
BaseQueryError<BaseQuery>
317+
BaseQueryError<BaseQuery>,
318+
BaseQueryMeta<BaseQuery>
314319
>
315320
/**
316321
* Not to be used. A mutation should not provide tags to the cache.
@@ -429,17 +434,23 @@ export type EndpointBuilder<
429434

430435
export type AssertTagTypes = <T extends FullTagDescription<string>>(t: T) => T
431436

432-
export function calculateProvidedBy<ResultType, QueryArg, ErrorType>(
437+
export function calculateProvidedBy<ResultType, QueryArg, ErrorType, MetaType>(
433438
description:
434-
| ResultDescription<string, ResultType, QueryArg, ErrorType>
439+
| ResultDescription<string, ResultType, QueryArg, ErrorType, MetaType>
435440
| undefined,
436441
result: ResultType | undefined,
437442
error: ErrorType | undefined,
438443
queryArg: QueryArg,
444+
meta: MetaType | undefined,
439445
assertTagTypes: AssertTagTypes
440446
): readonly FullTagDescription<string>[] {
441447
if (isFunction(description)) {
442-
return description(result as ResultType, error as undefined, queryArg)
448+
return description(
449+
result as ResultType,
450+
error as undefined,
451+
queryArg,
452+
meta as MetaType
453+
)
443454
.map(expandTagDescription)
444455
.map(assertTagTypes)
445456
}

0 commit comments

Comments
 (0)