You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* This is a standard redux middleware and is responsible for things like polling, garbage collection and a handful of other things. Make sure it's included in your store.
* A thunk that (if dispatched) will return all running queries.
153
-
*
154
-
* Useful for SSR scenarios to await all running queries triggered in any way,
155
-
* including via hook calls or manually dispatching `initiate` actions.
156
-
*
157
-
* See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.
158
-
*/
159
-
getRunningQueriesThunk(): ThunkWithReturnValue<
160
-
Array<QueryActionCreatorResult<any>>
161
-
>
162
-
163
-
/**
164
-
* A thunk that (if dispatched) will return all running mutations.
165
-
*
166
-
* Useful for SSR scenarios to await all running mutations triggered in any way,
167
-
* including via hook calls or manually dispatching `initiate` actions.
168
-
*
169
-
* See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.
170
-
*/
171
-
getRunningMutationsThunk(): ThunkWithReturnValue<
172
-
Array<MutationActionCreatorResult<any>>
173
-
>
174
-
175
-
/**
176
-
* A Redux thunk that can be used to manually trigger pre-fetching of data.
177
-
*
178
-
* The thunk accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and a set of options used to determine if the data actually should be re-fetched based on cache staleness.
179
-
*
180
-
* React Hooks users will most likely never need to use this directly, as the `usePrefetch` hook will dispatch this thunk internally as needed when you call the prefetching function supplied by the hook.
* A Redux thunk action creator that, when dispatched, creates and applies a set of JSON diff/patch objects to the current state. This immediately updates the Redux state with those changes.
195
-
*
196
-
* The thunk action creator accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and an `updateRecipe` callback function. The callback receives an Immer-wrapped `draft` of the current state, and may modify the draft to match the expected results after the mutation completes successfully.
197
-
*
198
-
* The thunk executes _synchronously_, and returns an object containing `{patches: Patch[], inversePatches: Patch[], undo: () => void}`. The `patches` and `inversePatches` are generated using Immer's [`produceWithPatches` method](https://immerjs.github.io/immer/patches).
199
-
*
200
-
* This is typically used as the first step in implementing optimistic updates. The generated `inversePatches` can be used to revert the updates by calling `dispatch(patchQueryData(endpointName, args, inversePatches))`. Alternatively, the `undo` method can be called directly to achieve the same effect.
201
-
*
202
-
* Note that the first two arguments (`endpointName` and `args`) are used to determine which existing cache entry to update. If no existing cache entry is found, the `updateRecipe` callback will not run.
* A Redux thunk action creator that, when dispatched, acts as an artificial API request to upsert a value into the cache.
221
-
*
222
-
* The thunk action creator accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and the data to upsert.
223
-
*
224
-
* If no cache entry for that cache key exists, a cache entry will be created and the data added. If a cache entry already exists, this will _overwrite_ the existing cache entry data.
225
-
*
226
-
* The thunk executes _asynchronously_, and returns a promise that resolves when the store has been updated.
227
-
*
228
-
* If dispatched while an actual request is in progress, both the upsert and request will be handled as soon as they resolve, resulting in a "last result wins" update behavior.
* A Redux thunk that applies a JSON diff/patch array to the cached data for a given query result. This immediately updates the Redux state with those changes.
244
-
*
245
-
* The thunk accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and a JSON diff/patch array as produced by Immer's `produceWithPatches`.
246
-
*
247
-
* This is typically used as the second step in implementing optimistic updates. If a request fails, the optimistically-applied changes can be reverted by dispatching `patchQueryData` with the `inversePatches` that were generated by `updateQueryData` earlier.
248
-
*
249
-
* In cases where it is desired to simply revert the previous changes, it may be preferable to call the `undo` method returned from dispatching `updateQueryData` instead.
* A Redux action creator that can be dispatched to manually reset the api state completely. This will immediately remove all existing cache entries, and all queries will be considered 'uninitialized'.
275
-
*
276
-
* @example
277
-
*
278
-
* ```ts
279
-
* dispatch(api.util.resetApiState())
280
-
* ```
281
-
*/
282
-
resetApiState: SliceActions['resetApiState']
283
-
/**
284
-
* A Redux action creator that can be used to manually invalidate cache tags for [automated re-fetching](../../usage/automated-refetching.mdx).
285
-
*
286
-
* The action creator accepts one argument: the cache tags to be invalidated. It returns an action with those tags as a payload, and the corresponding `invalidateTags` action type for the api.
287
-
*
288
-
* Dispatching the result of this action creator will [invalidate](../../usage/automated-refetching.mdx#invalidating-cache-data) the given tags, causing queries to automatically re-fetch if they are subscribed to cache data that [provides](../../usage/automated-refetching.mdx#providing-cache-data) the corresponding tags.
289
-
*
290
-
* The array of tags provided to the action creator should be in one of the following formats, where `TagType` is equal to a string provided to the [`tagTypes`](../createApi.mdx#tagtypes) property of the api:
0 commit comments