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
Copy file name to clipboardexpand all lines: docs/api/createAsyncThunk.mdx
+1-1
Original file line number
Diff line number
Diff line change
@@ -108,7 +108,7 @@ An object with the following optional fields:
108
108
109
109
-`condition(arg, { getState, extra } ): boolean | Promise<boolean>`: a callback that can be used to skip execution of the payload creator and all action dispatches, if desired. See [Canceling Before Execution](#canceling-before-execution) for a complete description.
110
110
-`dispatchConditionRejection`: if `condition()` returns `false`, the default behavior is that no actions will be dispatched at all. If you still want a "rejected" action to be dispatched when the thunk was canceled, set this flag to `true`.
111
-
-`idGenerator(arg): string`: a function to use when generating the `requestId` for the request sequence. Defaults to use [nanoid](./otherExports.mdx/#nanoid), but you can implement your own ID generation logic.
111
+
-`idGenerator(arg): string`: a function to use when generating the `requestId` for the request sequence. Defaults to use [nanoid](./otherExports.mdx#nanoid), but you can implement your own ID generation logic.
112
112
-`serializeError(error: unknown) => any` to replace the internal `miniSerializeError` method with your own serialization logic.
113
113
-`getPendingMeta({ arg, requestId }, { getState, extra }): any`: a function to create an object that will be merged into the `pendingAction.meta` field.
1. invalidateTags function is called with a list of tags generated from the action metadata
65
65
2. in the case of a [queryThunk] resolution an empty set of tags is always provided
66
-
2. The tags calculated are added to the list of pending tags to invalidate (see [delayed](#Delayed))
66
+
2. The tags calculated are added to the list of pending tags to invalidate (see [delayed](#delayed))
67
67
3. (optional: 'Delayed') the invalidateTags function is ended if the `apiSlice.invalidationBehavior` is set to "delayed" and there are any pending thunks/queries running in that `apiSlice`
68
68
4. Pending tags are reset to an empty list, if there are no tags the function ends here
69
69
5. Selects all `{ endpointName, originalArgs, queryCacheKey }` combinations that would be invalidated by a specific set of tags.
Copy file name to clipboardexpand all lines: docs/rtk-query/overview.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -179,7 +179,7 @@ export default function App() {
179
179
180
180
## Further Information
181
181
182
-
See the [**RTK Query Quick Start tutorial**](../tutorials/rtk-query.mdx/) for examples of how to add RTK Query to a project that uses Redux Toolkit, set up an "API slice" with endpoint definitions, and how to use the auto-generated React hooks in your components.
182
+
See the [**RTK Query Quick Start tutorial**](../tutorials/rtk-query.mdx) for examples of how to add RTK Query to a project that uses Redux Toolkit, set up an "API slice" with endpoint definitions, and how to use the auto-generated React hooks in your components.
183
183
184
184
The [**RTK Query usage guide section**](./usage/queries.mdx) has information on topics like [querying data](./usage/queries.mdx), [using mutations to send updates to the server](./usage/mutations.mdx), [streaming cache updates](./usage/streaming-updates.mdx), and much more.
Copy file name to clipboardexpand all lines: docs/rtk-query/usage-with-typescript.mdx
+2-2
Original file line number
Diff line number
Diff line change
@@ -527,7 +527,7 @@ function MaybePost({ id }: { id?: number }) {
527
527
528
528
## Type safe error handling
529
529
530
-
When an error is gracefully provided from a [`base query`](./api/createApi.mdx#baseQuery), RTK query will provide the error
530
+
When an error is gracefully provided from a [`base query`](./api/createApi.mdx#basequery), RTK query will provide the error
531
531
directly. If an unexpected error is thrown by user code rather than a handled error,
532
532
that error will be transformed into a `SerializedError` shape. Users should make sure that they are checking which kind of error they are dealing with before attempting to access its properties. This can be done in a type safe manner either
533
533
by using a type guard, e.g. by checking for [discriminated properties](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#the-in-operator-narrowing),
@@ -613,7 +613,7 @@ function PostDetail() {
613
613
<div>{errMsg}</div>
614
614
</div>
615
615
)
616
-
}
616
+
}
617
617
// you can access all properties of `SerializedError` here
Copy file name to clipboardexpand all lines: docs/rtk-query/usage/cache-behavior.mdx
+1-1
Original file line number
Diff line number
Diff line change
@@ -403,7 +403,7 @@ The Redux docs have always recommended [keeping data in a normalized lookup tabl
403
403
404
404
There are a couple additional points that can help here:
405
405
406
-
- The generated query hooks have [a `selectFromResult` option](../api/created-api/hooks.mdx#selectfromresult) that allow components to read individual pieces of data from a query result. As an example, a `<TodoList>` component might call `useTodosQuery()`, and each individual `<TodoListItem>` could use the same query hook but select from the result to get the right todo object.
406
+
- The generated query hooks have [a `selectFromResult` option](../api/created-api/hooks.mdx#usequery) that allow components to read individual pieces of data from a query result. As an example, a `<TodoList>` component might call `useTodosQuery()`, and each individual `<TodoListItem>` could use the same query hook but select from the result to get the right todo object.
407
407
- You can use the [`transformResponse` endpoint option](../api/createApi.mdx#transformresponse) to modify the fetched data so that it's [stored in a different shape](./customizing-queries.mdx#customizing-query-responses-with-transformresponse), such as using `createEntityAdapter` to normalize the data _for this one response_ before it's inserted into the cache.
@@ -980,7 +980,7 @@ You could also try creating a custom base query that uses the SDK, and define en
980
980
981
981
In certain scenarios, you may wish to have a `query` or `mutation` where sending a request or returning data is not relevant for the situation. Such a scenario would be to leverage the `invalidatesTags` property to force re-fetch specific `tags` that have been provided to the cache.
982
982
983
-
See also [`providing errors to the cache`](./automated-refetching.mdx#providing-data-to-the-cache) to see additional detail and an example for such a scenario to 'refetch errored queries'.
983
+
See also ["providing errors to the cache"](./automated-refetching.mdx#providing-errors-to-the-cache) to see additional detail and an example for such a scenario to 'refetch errored queries'.
Copy file name to clipboardexpand all lines: docs/rtk-query/usage/error-handling.mdx
+1-1
Original file line number
Diff line number
Diff line change
@@ -76,7 +76,7 @@ There are quite a few ways that you can manage your errors, and in some cases, y
76
76
77
77
:::tip
78
78
79
-
Redux Toolkit has [action matching utilities](../../api/matching-utilities.mdx#matching-utilities) that we can leverage for additional custom behaviors.
79
+
Redux Toolkit has [action matching utilities](../../api/matching-utilities.mdx) that we can leverage for additional custom behaviors.
With the addition of the [callback syntax for createSlice](#callback-syntax-for-createslicereducers), the [suggestion](https://github.com/reduxjs/redux-toolkit/issues/3837) was made to enable custom slice reducer creators. These creators would be able to:
900
+
With the addition of the [callback syntax for createSlice](#createslicereducers-callback-syntax-and-thunk-support), the [suggestion](https://github.com/reduxjs/redux-toolkit/issues/3837) was made to enable custom slice reducer creators. These creators would be able to:
901
901
902
902
- Modify reducer behavior by adding case or matcher reducers
903
903
- Attach actions (or any other useful functions) to `slice.actions`
Copy file name to clipboardexpand all lines: docs/usage/usage-with-typescript.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -413,7 +413,7 @@ type AtLeastOneUserField = AtLeastOne<User>
413
413
414
414
### Typing Async Thunks Inside `createSlice`
415
415
416
-
As of 2.0, `createSlice` allows [defining thunks inside of `reducers` using a callback syntax](../api/createSlice.mdx/#the-reducers-creator-callback-notation).
416
+
As of 2.0, `createSlice` allows [defining thunks inside of `reducers` using a callback syntax](../api/createSlice.mdx#the-reducers-creator-callback-notation).
417
417
418
418
Typing for the `create.asyncThunk` method works in the same way as [`createAsyncThunk`](#createasyncthunk), with one key difference.
0 commit comments