-
Notifications
You must be signed in to change notification settings - Fork 195
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
Network request error creates non-serializable action #252
Comments
Actually it will throw this warning in more cases for all this errors I think that this errors can be replaced with some raw objects. But this will imply a breaking change, because this errors a part of public API https://github.com/agraboso/redux-api-middleware/blob/master/src/errors.js |
I am using redux toolkit with react native and custom fetch implementation and I've noticed something similar. It fails intermittently with the non-serializable error complaining about the provided fetch property. It is really hard to debug cause It happens like 2% of the times. |
A solution would be to implement |
Same setup here although I am experiencing the same issue but with @ghost, I know that this is bad and I prefer not to do it either, but you can disable the serialization check with the following:
A better solution is probably to handle the failure type and return a plain object if you want to keep the serializable checker on: It would be nice if by default the raw objects where returned from the errors or all of them to have a |
I actually solved the problem. In my case it was my token refresh functionality and custom fetch attached to every action. After receiving 401 (expired token) I was getting new token and retrying all queued requests. All re-tries were getting non-serializable action warning. I simply passed my custom fetch implementation to createMiddleware() instead of passing to each action as a prop. |
I'm using
redux-toolkit
which includes custom middleware that checks if Redux actions are serializable. When aRequestError
occurs, it looks likeredux-api-middleware
creates a non-serializable Redux action, which it probably shouldn't:The text was updated successfully, but these errors were encountered: