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
support passing an external abortsignal to createAsyncThunk (#4860)
* support passing an external abortsignal to createAsyncThunk
* make our own promiseWithResolvers
* jsdoc
* add once option
* added docs
* added no-transpile
Copy file name to clipboardExpand all lines: docs/api/createAsyncThunk.mdx
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -133,6 +133,18 @@ When dispatched, the thunk will:
133
133
- if the promise failed and was not handled with `rejectWithValue`, dispatch the `rejected` action with a serialized version of the error value as `action.error`
134
134
- Return a fulfilled promise containing the final dispatched action (either the `fulfilled` or `rejected` action object)
135
135
136
+
## Thunk Dispatch Options
137
+
138
+
The returned thunk action creator accepts an optional second argument with the following options:
139
+
140
+
-`signal`: an optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that will be tracked by the internal abort signal (see [Canceling While Running](#canceling-while-running))
`createAsyncThunk` will generate three Redux action creators using [`createAction`](./createAction.mdx): `pending`, `fulfilled`, and `rejected`. Each lifecycle action creator will be attached to the returned thunk action creator so that your reducer logic can reference the action types and respond to the actions when dispatched. Each action object will contain the current unique `requestId` and `arg` values under `action.meta`.
0 commit comments