This release reworks the cancellation functionality in createAsyncThunk
.
Changes
createAsyncThunk
cancellation
We previously added AbortController
support to createAsyncThunk
, to allow other code to trigger whatever cancellation might be applicable to the async logic inside.
The thunk now exits early when the abort()
method is called and doesn't keep waiting for the payloadCreator
to finish. This should be an improvement especially in cases where the payloadCreator
didn't care about the abort signal, but something outside was awaiting the promise from dispatch.
Also, before this, a non-signal-aware payloadCreator
could still finish which would have caused a dispatch of a "fulfilled" action after an "rejected" (abort) action, which was confusing.
We've also removed the meta.abortReason
property as it's no longer possible to override the error in the "rejected" action.