-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
createAsyncThunk: serializeError option #812
createAsyncThunk: serializeError option #812
Conversation
Also pinging @nathggns on that one. If you really see any value in this, try to convince me :) |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 32281aa:
|
94c67a2
to
c6346cf
Compare
ca13a71
to
02c8e04
Compare
.github/workflows/tests.yml
Outdated
- name: Prefix `freeze` re-export for pre-3.7 TS versions with @ts-ignore | ||
if: ${{ matrix.ts < 3.7 }} | ||
run: | | ||
sed -i -e "/export .* freeze .* from 'immer'/s/^/\/\/ @ts-ignore\n/" dist/typings.d.ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤣
02c8e04
to
32281aa
Compare
- name: Prefix `freeze` re-export for pre-3.7 TS versions with @ts-ignore | ||
if: ${{ matrix.ts < 3.7 }} | ||
run: | | ||
sed -i -e "/import .* freeze .* from 'immer'/s/^/\/\/ @ts-ignore\n/" dist/typings.d.ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤯
Thanks for this — sorry I couldn't get around to writing this myself after our conversations. I think this is going to make quite a big difference to removing a lot of complexity in some of our code and I appreciate it. |
Should |
This would address two requests from #792:
serializeError
option tocreateAsyncThunk
await dispatch(async(3, { unwrap: true }))
and return it with the unwrapped result and otherwise throw an error. So, essentially an inlined version ofunwrapResult
.I say would because I'm still not a fan of Nr 2. Even less, after writing all this, tbh.
The amount of code (and especially types) required to support a second way of doing something we already have in the lib makes me uneasy.
Yes, it might be slightly "nicer". But only slightly. And it's a lot of code. And a lot of new behaviour (especially type-wise) that we have to commit to keep running.
So my personal suggestion would be to keep 1. (even though it also does something comparable to
rejectWithValue
as well) and not merge 2 (no matter the amount of work I put into this).