Open IceToast opened 4 years ago
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 requests.queries.transparency/overviewCharts.error.config.cancelToken.reason
. For sure I don't mutate it, I just store axios error in reducer. Probably it is axios itself which does this mutation. I am pretty sure this is harmless.
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
function the team ended up with:
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: