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/configureStore.mdx
+14-11
Original file line number
Diff line number
Diff line change
@@ -98,16 +98,17 @@ For more details on how the `middleware` parameter works and the list of middlew
98
98
99
99
### `devTools`
100
100
101
-
If this is a boolean, it will be used to indicate whether `configureStore` should automatically enable support for [the Redux DevTools browser extension](https://github.com/zalmoxisus/redux-devtools-extension).
101
+
If this is a boolean, it will be used to indicate whether `configureStore` should automatically enable support for [the Redux DevTools browser extension](https://github.com/reduxjs/redux-devtools).
102
102
103
103
Ifitisanobject, thentheDevToolsExtensionwillbeenabled, andtheoptionsobjectwillbepassedto`composeWithDevtools()`. See
104
-
theDevToolsExtensiondocsfor [`EnhancerOptions`](https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/API/Arguments.md#windowdevtoolsextensionconfig) for
104
+
theDevToolsExtensiondocsfor [`EnhancerOptions`](https://github.com/reduxjs/redux-devtools/blob/main/extension/docs/API/Arguments.md) for
105
105
alistofthespecificoptionsthatareavailable.
106
106
107
107
Defaultsto`true`.
108
108
109
-
TheReduxDevToolsExtensionrecentlyadded [supportforshowingactionstacktraces](https://github.com/zalmoxisus/redux-devtools-extension/blob/d4ef75691ad294646f74bca38b973b19850a37cf/docs/Features/Trace.md) that show exactly where each action was dispatched. Capturing the traces can add a bit of overhead, so the DevTools Extension allows users to configure whether action stack traces are captured.
110
-
109
+
#### `trace`
110
+
TheReduxDevToolsExtensionrecentlyadded [supportforshowingactionstacktraces](https://github.com/reduxjs/redux-devtools/blob/main/extension/docs/Features/Trace.md) that show exactly where each action was dispatched.
### Checking if a Promise Rejection was from an Error or Cancellation
512
+
513
+
To investigate behavior around thunk cancellation, you can inspect various properties on the `meta` object of the dispatched action.
514
+
If a thunk was cancelled, the result of the promise will be a `rejected` action (regardless of whether that action was actually dispatched to the store).
515
+
516
+
- If it was cancelled before execution, `meta.condition` will be true.
517
+
- If it was aborted while running, `meta.aborted` will be true.
518
+
- If neither of those is true, the thunk was not cancelled, it was simply rejected, either by a Promise rejection or `rejectWithValue`.
519
+
- If the thunk was not rejected, both `meta.aborted` and `meta.condition` will be `undefined`.
520
+
521
+
So if you wanted to test that a thunk was cancelled before executing, you can do the following:
Ifyouneedtocustomizethecreationofthepayloadvalueofanactioncreatorbymeansofa [`prepare callback`](./createAction.mdx#using-prepare-callbacks-to-customize-action-contents), thevalueoftheappropriatefieldofthe`reducers`argumentobjectshouldbeanobjectinsteadofafunction. This object must contain two properties: `reducer` and `prepare`. The value of the `reducer` field should be the case reducer function while the value of the `prepare` field should be the prepare callback function:
109
110
110
111
```ts
111
-
import { createSlice, PayloadAction, nanoid } from '@reduxjs/toolkit'
112
+
import { createSlice, nanoid } from '@reduxjs/toolkit'
113
+
import type { PayloadAction } from '@reduxjs/toolkit'
112
114
113
115
interface Item {
114
116
id: string
@@ -224,7 +226,8 @@ for references in a larger codebase.
224
226
## Examples
225
227
226
228
```ts
227
-
import { createSlice, createAction, PayloadAction } from '@reduxjs/toolkit'
229
+
import { createSlice, createAction } from '@reduxjs/toolkit'
230
+
import type { PayloadAction } from '@reduxjs/toolkit'
228
231
import { createStore, combineReducers } from 'redux'
Copy file name to clipboardExpand all lines: docs/api/matching-utilities.mdx
+18-10
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,8 @@ Accepts the same inputs as `isAllOf` and will return a type guard function that
48
48
A higher-order function that returns a type guard function that may be used to check whether an action was created by [`createAsyncThunk`](./createAsyncThunk).
@@ -65,7 +66,8 @@ function handleRequestAction(action: AnyAction) {
65
66
A higher-order function that returns a type guard function that may be used to check whether an action is a 'pending' action creator from the `createAsyncThunk` promise lifecycle.
@@ -82,7 +84,8 @@ function handlePendingAction(action: AnyAction) {
82
84
A higher-order function that returns a type guard function that may be used to check whether an action is a 'fulfilled'' action creator from the `createAsyncThunk` promise lifecycle.
@@ -99,7 +102,8 @@ function handleFulfilledAction(action: AnyAction) {
99
102
A higher-order function that returns a type guard function that may be used to check whether an action is a 'rejected' action creator from the `createAsyncThunk` promise lifecycle.
@@ -116,7 +120,8 @@ function handleRejectedAction(action: AnyAction) {
116
120
A higher-order function that returns a type guard function that may be used to check whether an action is a 'rejected' action creator from the `createAsyncThunk` promise lifecycle that was created by [`rejectWithValue`](./createAsyncThunk#handling-thunk-errors).
0 commit comments