-
-
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
Add "createAsyncThunkCreator" with option for customizing default error serializer #4549
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
✅ Deploy Preview for redux-starter-kit-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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 66f7494:
|
the type changes to miniSerializeError are not safe - the function will only ever return a SerializedError shape, regardless of what your config says. |
I have to admit I'm a bit hesitant to add additional runtime code for this, especially with a name like Alternative suggestion - we could export something like a That would make it possible to define something like this in userland: export const createAppAsyncThunk: CreateAsyncThunkWithoutWithTypes<{
serializedErrorType: number;
}> = (typePrefix: string, payloadCreator: any, options: any) => {
return createAsyncThunk(typePrefix, payloadCreator, {
...options,
serializeError: mySerializeError,
}) as any;
}; What do you think? |
Yeah, this looks like a good solution to me. |
@jesperjohansson raised #4667 with the solution posed - that should have a build you'll be able to install and try out in the meantime of us getting this in. happy for this PR to be closed in favour of the other? |
Adds a new
createAsyncThunkCreator
method which can be used to set the custom error serializer.Closes #4548