-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
"Invariant failed" on failed request #388
Comments
Hi, glad you like it! Regarding this error, I never encountered this. Could you please first try whether you could reproduce it in this example? https://github.com/klis87/redux-requests/tree/master/examples/advanced - it also uses axios |
It looks like it complains about mutation in requests reducer, but I don't think I do any mutations: o could you show me transparency/overviewCharts request action? |
Hi, it's me again - @IceToast is a coworker of mine. This is how the action looks like: {
type: 'transparency/overviewCharts',
payload: {
request: {
url: '/transparency/overviewCharts?reportingPeriod=2019-Q4'
}
}
} Many thanks in advance and best regards! =) |
@tonitassimo cool, so you use it in the whole team! ;) so nothing fancy here, I am suspecting that this error is actually not really error, but you use tookit and if I remember correctly it has some dev tool included which checks if there are any mutations (forbidden) done on redux state. Looking at this error, I can see that this is related to It would be cool if you could verify this error doesn't happen in example I posted in my previous post. I don't use there any anti mutation checker, so it would mean that this is toolkit related. If yes, maybe there is a way to make some exceptions so some keys are not protected for mutation? Alternative would be to debug axios and ask them not to mutate error there. |
Thanks for your reply again! We just had to disable "immutableCheck". Now it works without any exceptions! |
Adding to the solution, here's the configureStore({
reducer: reducers,
preloadedState: initialState,
middleware: getDefaultMiddleware({ serializableCheck: false, immutableCheck: false }).concat(requestsMiddleware),
}) |
@tonitassimo no problem, nice it works now @Flixbox thx for the solution! btw, do you know whether this issue happens for any Axios error? |
I think this should really be solved on axios level, at some point I will check this and file issue/PR on axios library, I don't think they should mutate error object after throwing, but we need to see when they do that. |
Hey there,
first of all thank you for developing this library!
We are getting an exception that causes an application crash.
Steps to reproduce:
Store.js:
Store:
The text was updated successfully, but these errors were encountered: