Falsy rejectWithValue payloads lose rejectedWithValue semantics
Author: OskarEichlerCreated Aug 30, 2026Updated Aug 30, 2026
Reproduction
const thunk = createAsyncThunk("test", (_, api) => api.rejectWithValue(0))
const promise = store.dispatch(thunk())
const action = await promise
action.payload // 0
action.meta.rejectedWithValue // false
await promise.unwrap() // throws { message: "Rejected" }, not 0Current master (74200d87) derives rejectedWithValue with !!payload, so false, 0, "", null, and undefined all lose the fact that the payload came from rejectWithValue. This also changes unwrapResult / .unwrap() behavior.
Expected
meta.rejectedWithValue should describe how the rejection was created, independent of payload truthiness, and unwrap should throw the exact supplied rejection value. The public type already models this as a discriminant.
I have a focused implementation that distinguishes an omitted payload argument from an explicitly supplied falsy value without changing the public action-creator signature, plus runtime coverage for all five falsy values.
Source: reduxjs/redux-toolkit