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
### Checking if a Promise Rejection was from an Error or Cancellation
511
+
512
+
To investigate behavior around thunk cancellation, you can inspect various properties on the `meta` object of the dispatched action.
513
+
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).
514
+
515
+
- If it was cancelled before execution, `meta.condition` will be true.
516
+
- If it was aborted while running, `meta.aborted` will be true.
517
+
- If neither of those is true, the thunk was not cancelled, it was simply rejected, either by a Promise rejection or `rejectWithValue`.
518
+
- If the thunk was not rejected, both `meta.aborted` and `meta.condition` will be `undefined`.
519
+
520
+
So if you wanted to test that a thunk was cancelled before executing, you can do the following:
0 commit comments