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
If you need to cancel a thunk before the payload creator is called, you may provide a `condition` callback as an option after the payload creator. The callback will receive the thunk argument and an object with `{getState, extra}` as parameters, and use those to decide whether to continue or not. If the execution should be canceled, the `condition` callback should return a literal `false` value or a promise that should resolve to `false`. If a promise is returned, the thunk waits for it to get fulfilled before dispatching the `pending` action, otherwise it proceeds with dispatching synchronously.
375
371
376
-
```ts
372
+
```ts no-transpile
377
373
const fetchUserById =createAsyncThunk(
378
374
'users/fetchByIdStatus',
379
375
async (userId:number, thunkAPI) => {
@@ -401,7 +397,7 @@ If you want to cancel your running thunk before it has finished, you can use the
0 commit comments