@@ -228,6 +228,54 @@ React Hooks users will most likely never need to use this directly, as the `useP
228
228
dispatch (api .util .prefetch (' getPosts' , undefined , { force: true }))
229
229
```
230
230
231
+ ### ` selectInvalidatedBy `
232
+
233
+ #### Signature
234
+
235
+ ``` ts no-transpile
236
+ function selectInvalidatedBy(
237
+ state : RootState ,
238
+ tags : ReadonlyArray <TagDescription <string >>
239
+ ): Array <{
240
+ endpointName: string
241
+ originalArgs: any
242
+ queryCacheKey: QueryCacheKey
243
+ }>
244
+ ```
245
+
246
+ - ** Parameters **
247
+ - ` state ` : the root state
248
+ - ` tags ` : a readonly array of invalidated tags , where the provided ` TagDescription ` is one of the strings provided to the [` tagTypes ` ](../ createApi .mdx #tagtypes ) property of the api . e .g .
249
+ - ` [TagType] `
250
+ - ` [{ type: TagType }] `
251
+ - ` [{ type: TagType, id: number | string }] `
252
+
253
+ #### Description
254
+
255
+ A function that can select query parameters to be invalidated.
256
+
257
+ The function accepts two arguments
258
+ - the root state and
259
+ - the cache tags to be invalidated.
260
+
261
+ It returns an array that contains
262
+ - the endpoint name ,
263
+ - the original args and
264
+ - the queryCacheKey .
265
+
266
+ #### Example
267
+
268
+ ` ` ` ts no-transpile
269
+ dispatch(api.util.selectInvalidatedBy(state, ['Post']))
270
+ dispatch(api.util.selectInvalidatedBy(state, [{ type: 'Post', id: 1 }]))
271
+ dispatch(
272
+ api.util.selectInvalidatedBy(state, [
273
+ { type: 'Post', id: 1 },
274
+ { type: 'Post', id: 4 },
275
+ ])
276
+ )
277
+ ` ` `
278
+
231
279
### ` invalidateTags `
232
280
233
281
#### Signature
0 commit comments