redux-requests
redux-requests copied to clipboard
"Invariant failed" on failed request
Hey there, first of all thank you for developing this library!
We are getting an exception that causes an application crash.
Steps to reproduce:
- Load the full application
- Cut network connection
- Create a request action
Uncaught Error: Invariant failed: A state mutation was detected inside a dispatch, in the path: requests.queries.transparency/overviewCharts.error.config.cancelToken.reason. Take a look at the reducer(s) handling the action {"type":"transparency/overviewCharts","payload":{"request":{"url":"/transparency/overviewCharts?reportingPeriod=2018-Q4"}}}. (https://redux.js.org/troubleshooting#never-mutate-reducer-arguments)
at invariant (immutableStateInvariantMiddleware.ts:25)
at immutableStateInvariantMiddleware.ts:271
at Object.measureTime (utils.ts:9)
at Object.dispatch (immutableStateInvariantMiddleware.ts:264)
at dispatch (<anonymous>:1:28545)
at TransparencyViewDecorator.js:19
at commitHookEffectListMount (react-dom.development.js:19731)
at commitPassiveHookEffects (react-dom.development.js:19769)
at HTMLUnknownElement.callCallback (react-dom.development.js:188)
at Object.invokeGuardedCallbackDev (react-dom.development.js:237)
at invokeGuardedCallback (react-dom.development.js:292)
at flushPassiveEffectsImpl (react-dom.development.js:22853)
at unstable_runWithPriority (scheduler.development.js:653)
at runWithPriority$1 (react-dom.development.js:11039)
at flushPassiveEffects (react-dom.development.js:22820)
at performSyncWorkOnRoot (react-dom.development.js:21737)
at react-dom.development.js:11089
at unstable_runWithPriority (scheduler.development.js:653)
at runWithPriority$1 (react-dom.development.js:11039)
at flushSyncCallbackQueueImpl (react-dom.development.js:11084)
at flushSyncCallbackQueue (react-dom.development.js:11072)
at discreteUpdates$1 (react-dom.development.js:21893)
at discreteUpdates (react-dom.development.js:806)
at dispatchDiscreteEvent (react-dom.development.js:4168)
Store.js:
import { configureStore, combineReducers, getDefaultMiddleware } from '@reduxjs/toolkit'
import { handleRequests } from '@redux-requests/core'
import { createDriver } from '@redux-requests/axios'
import rootReducers from './reducers'
import { getTenant } from './actions/actions.tenant'
import { fetchVersionInfo } from './actions/actions.system'
import axiosInstance from './helpers/AxiosInstance'
import { openDialog } from './actions/actions.dialog'
const setupStore = initialState => {
const { requestsReducer, requestsMiddleware } = handleRequests({
driver: createDriver(axiosInstance),
onError: (error, action, store) => {
store.dispatch(openDialog('errorDialog'))
throw error
},
})
const reducers = combineReducers({
requests: requestsReducer,
...rootReducers,
})
return configureStore({
reducer: reducers,
preloadedState: initialState,
middleware: getDefaultMiddleware({ serializableCheck: false }).concat(requestsMiddleware),
})
}
export const setupStoreAsync = async () => {
const store = setupStore()
const results = await Promise.all([store.dispatch(getTenant()), store.dispatch(fetchVersionInfo())])
results.forEach(result => {
if (result.action.error) throw result.error
})
return store
}
Store:
{
"payload": "[{\"type\":\"tenant/current\",\"payload\":{\"request\":{\"url\":\"/tenant/current\"}}},{\"type\":\"system/version\",\"payload\":{\"request\":{\"url\":\"/system/version\"}}},{\"type\":\"system/version_SUCCESS\",\"payload\":{\"data\":{\"assembly\":\"0.1.151-preview+3794dd2e2e\",\"commitId\":\"3794dd2e2e8e8ae738dcda19f31f294eb8a6ab6e\",\"runtime\":\".NET 5.0.0-rc.2.20475.5\",\"system\":\"Linux 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 X64\",\"application\":\"0.1.151-preview\",\"database\":\"SqlServer - 20201021070947_Initial\"},\"status\":200,\"headers\":{\"content-type\":\"application/json; charset=utf-8\"}},\"meta\":{\"requestAction\":{\"type\":\"system/version\",\"payload\":{\"request\":{\"url\":\"/system/version\"}}}}},{\"type\":\"tenant/current_SUCCESS\",\"payload\":{\"data\":{\"id\":9999,\"name\":\"capitX\",\"primaryColor\":\"#FF9020\",\"secondaryColor\":\"#004060\",\"logoId\":9999,\"slogan\":\"capital banking Xolutions 4u\",\"link\":\"https://www.qqq.de/\",\"imprintLink\":\"http://p520372.mittwaldserver.info/impressum\",\"privacyPolicyLink\":\"http://p520372.mittwaldserver.info/datenschutz\",\"isAssociation\":false},\"status\":200,\"headers\":{\"content-type\":\"application/json; charset=utf-8\"}},\"meta\":{\"requestAction\":{\"type\":\"tenant/current\",\"payload\":{\"request\":{\"url\":\"/tenant/current\"}}}}},{\"type\":\"tenant/reportingPeriods\",\"payload\":{\"request\":{\"url\":\"/tenant/reportingPeriods\"}}},{\"type\":\"set/tenantIdentifier\",\"payload\":\"\"},{\"type\":\"tenant/reportingPeriods_SUCCESS\",\"payload\":{\"data\":[{\"id\":\"2019-Q4\",\"caption\":\"4. Quartal 2019\",\"shortCaption\":\"Q4 19\",\"isActive\":true},{\"id\":\"2019-Q3\",\"caption\":\"3. Quartal 2019\",\"shortCaption\":\"Q3 19\",\"isActive\":true},{\"id\":\"2018-Q4\",\"caption\":\"4. Quartal 2018\",\"shortCaption\":\"Q4 18\",\"isActive\":true},{\"id\":\"2018-Q3\",\"caption\":\"3. Quartal 2018\",\"shortCaption\":\"Q3 18\",\"isActive\":true}],\"status\":200,\"headers\":{\"content-type\":\"application/json; charset=utf-8\"}},\"meta\":{\"requestAction\":{\"type\":\"tenant/reportingPeriods\",\"payload\":{\"request\":{\"url\":\"/tenant/reportingPeriods\"}}}}},{\"type\":\"transparency/overviewCharts\",\"payload\":{\"request\":{\"url\":\"/transparency/overviewCharts?reportingPeriod=2019-Q4\"}}},{\"type\":\"transparency/overviewCharts_SUCCESS\",\"payload\":{\"data\":[{\"coveredBondType\":\"Hypothekenpfandbriefe\",\"reportingPeriod\":{\"year\":2019,\"quarter\":{\"month\":12,\"lastDay\":31,\"id\":4,\"name\":\"4. Quartal\"},\"caption\":\"4. Quartal 2019\",\"tableCaption\":\"Q4 2019\",\"shortCaption\":\"Q4 19\",\"code\":\"2019-Q4\",\"publicationDate\":\"2020-03-01T00:00:00\"},\"maturityStructure\":{\"header\":\"Laufzeitstruktur\",\"rows\":[{\"caption\":\"bis 0,5 Jahre\",\"circulation\":0,\"coverPool\":4937748},{\"caption\":\"bis 1 Jahr\",\"circulation\":0,\"coverPool\":5892252},{\"caption\":\"bis 1,5 Jahre\",\"circulation\":0,\"coverPool\":4567004},{\"caption\":\"bis 2 Jahre\",\"circulation\":0,\"coverPool\":6955451},{\"caption\":\"bis 3 Jahre\",\"circulation\":0,\"coverPool\":11786825},{\"caption\":\"bis 4 Jahre\",\"circulation\":0,\"coverPool\":26158005},{\"caption\":\"bis 5 Jahre\",\"circulation\":0,\"coverPool\":20574183},{\"caption\":\"bis 10 Jahre\",\"circulation\":0,\"coverPool\":117856040},{\"caption\":\"über 10 Jahre\",\"circulation\":15000000,\"coverPool\":55985863}]},\"compositions\":[{\"header\":\"Granularität Deckungsmasse (Größenklassen)\",\"rows\":[{\"caption\":\"bis einschließlich 300 Tsd. €\",\"value\":192722861},{\"caption\":\"über 300 Tsd. € bis einschließlich 1 Mio. €\",\"value\":45684512},{\"caption\":\"über 1 Mio. € bis einschließlich 10 Mio. €\",\"value\":6306000}]},{\"header\":\"Zusammensetzung Deckungsmasse wohnwirtschaftlich\",\"rows\":[{\"caption\":\"Ein- und Zweifamilienhäuser\",\"value\":159000000},{\"caption\":\"Mehrfamilienhäuser\",\"value\":67200000},{\"caption\":\"Eigentumswohnungen\",\"value\":16300000}]},{\"header\":\"Zusammensetzung Deckungsmasse gewerblich\",\"rows\":[{\"caption\":\"Sonstige Gebäude\",\"value\":1900000},{\"caption\":\"Bürogebäude\",\"value\":300000}]}]},{\"coveredBondType\":\"Öffentliche Pfandbriefe\",\"reportingPeriod\":{\"year\":2019,\"quarter\":{\"month\":12,\"lastDay\":31,\"id\":4,\"name\":\"4. Quartal\"},\"caption\":\"4. Quartal 2019\",\"tableCaption\":\"Q4 2019\",\"shortCaption\":\"Q4 19\",\"code\":\"2019-Q4\",\"publicationDate\":\"2020-03-01T00:00:00\"},\"maturityStructure\":{\"header\":\"Laufzeitstruktur\",\"rows\":[{\"caption\":\"bis 0,5 Jahre\",\"circulation\":20000000,\"coverPool\":8967448},{\"caption\":\"bis 1 Jahr\",\"circulation\":0,\"coverPool\":15382205},{\"caption\":\"bis 1,5 Jahre\",\"circulation\":10000000,\"coverPool\":1449063},{\"caption\":\"bis 2 Jahre\",\"circulation\":10000000,\"coverPool\":32790024},{\"caption\":\"bis 3 Jahre\",\"circulation\":20000000,\"coverPool\":17957617},{\"caption\":\"bis 4 Jahre\",\"circulation\":20000000,\"coverPool\":58829099},{\"caption\":\"bis 5 Jahre\",\"circulation\":0,\"coverPool\":45610045},{\"caption\":\"bis 10 Jahre\",\"circulation\":36000000,\"coverPool\":41398567},{\"caption\":\"über 10 Jahre\",\"circulation\":20200000,\"coverPool\":0}]},\"compositions\":[{\"header\":\"Granularität Deckungsmasse (Größenklassen)\",\"rows\":[{\"caption\":\"über 10 Mio. € bis einschließlich 100 Mio. €\",\"value\":208615286},{\"caption\":\"bis einschließlich 10 Mio. €\",\"value\":13768780}]},{\"header\":\"Zusammensetzung Deckungsmasse geschuldet\",\"rows\":[{\"caption\":\"Örtliche Gebietskörperschaften\",\"value\":138500000},{\"caption\":\"Regionale Gebietskörperschaften\",\"value\":85000000}]}]}],\"status\":200,\"headers\":{\"content-type\":\"application/json; charset=utf-8\"}},\"meta\":{\"requestAction\":{\"type\":\"transparency/overviewCharts\",\"payload\":{\"request\":{\"url\":\"/transparency/overviewCharts?reportingPeriod=2019-Q4\"}}}}},{\"type\":\"auth/setUser\",\"payload\":{\"token\":\"eyJhbGciOiJSUzI1NiIsImtpZCI6IkY5QkVFMDY3MEEyQzVFQ0QxMDFEQzlGM0EyQjBBOEMwIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2MDMyODUyNzEsImV4cCI6MTYwMzI4ODg3MSwiaXNzIjoiaHR0cHM6Ly9hY2NvdW50cy50eHMuZGUiLCJhdWQiOiJ0cmF2b3hBcGkiLCJjbGllbnRfaWQiOiJ0cmF2b3giLCJzdWIiOiI3OGYyOWZlYS1kYTVjLTRkOTEtOTE4Yy04NGYxZDY1NmZhNmYiLCJhdXRoX3RpbWUiOjE2MDMyODM2MjIsImlkcCI6ImxvY2FsIiwiZGlzcGxheW5hbWUiOiJTdXBlcnZpc29yIiwicm9sZSI6IlN1cGVydmlzb3IiLCJuYW1lIjoiYWRtaW4iLCJlbWFpbCI6ImFkbWluQHR4cy5kZSIsImp0aSI6IjNCRUQ1REMxNTA4NTA1REM3MTk2MUZBOEE3MEMxQzNFIiwic2lkIjoiRDI1RTU5Q0IxN0Q0RDQxRDEwMjAwQTA5RTVCMjIwODciLCJpYXQiOjE2MDMyODUyNzEsInNjb3BlIjpbIm9wZW5pZCIsInRyYXZveFByb2ZpbGUiLCJ0cmF2b3hBcGkiXSwiYW1yIjpbInB3ZCJdfQ.RJ2556MHIUe_4nJ2zJ84jOka1TFmBuChGMxiXB6naHsrrqoTtYW2qjv6aC4izOj8NBC5e_1AAl5W6b8aGJUmPL7FQguRDla1mC1mY9G_hlb3PikJl4ZfDxCCBBQ4kXJ4yThVsaydbSu8XhWnY7H3YpgUDd0QnQNbjegAylFfstNztr1y2WgF6iYDcJ5X1Tx3VcMV0oGPsMSZL8rK9Fo7BWwy5vh774BhPYDlZWjj7Vo8h2J6VnRZIjSPATkA46kg7XqERpX-XtB-_6Jz22jeCVbLd5Hu5YKPaWhAxszS8L-Fc-pJJU8VvRhAH3DnBz0jyPjQZFVmcxfm4-Ew5TvECQ\",\"profile\":{\"s_hash\":\"_pTU7c8cqJsk-bsk7mLcBQ\",\"sid\":\"D25E59CB17D4D41D10200A09E5B22087\",\"sub\":\"78f29fea-da5c-4d91-918c-84f1d656fa6f\",\"auth_time\":1603283622,\"idp\":\"local\",\"amr\":[\"pwd\"],\"displayname\":\"Supervisor\",\"name\":\"testuser\",\"email\":\"[email protected]\"},\"isAuthenticated\":true}},{\"type\":\"auth/setUser\",\"payload\":{\"token\":\"eyJhbGciOiJSUzI1NiIsImtpZCI6IkY5QkVFMDY3MEEyQzVFQ0QxMDFEQzlGM0EyQjBBOEMwIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2MDMyODUyNzEsImV4cCI6MTYwMzI4ODg3MSwiaXNzIjoiaHR0cHM6Ly9hY2NvdW50cy50eHMuZGUiLCJhdWQiOiJ0cmF2b3hBcGkiLCJjbGllbnRfaWQiOiJ0cmF2b3giLCJzdWIiOiI3OGYyOWZlYS1kYTVjLTRkOTEtOTE4Yy04NGYxZDY1NmZhNmYiLCJhdXRoX3RpbWUiOjE2MDMyODM2MjIsImlkcCI6ImxvY2FsIiwiZGlzcGxheW5hbWUiOiJTdXBlcnZpc29yIiwicm9sZSI6IlN1cGVydmlzb3IiLCJuYW1lIjoiYWRtaW4iLCJlbWFpbCI6ImFkbWluQHR4cy5kZSIsImp0aSI6IjNCRUQ1REMxNTA4NTA1REM3MTk2MUZBOEE3MEMxQzNFIiwic2lkIjoiRDI1RTU5Q0IxN0Q0RDQxRDEwMjAwQTA5RTVCMjIwODciLCJpYXQiOjE2MDMyODUyNzEsInNjb3BlIjpbIm9wZW5pZCIsInRyYXZveFByb2ZpbGUiLCJ0cmF2b3hBcGkiXSwiYW1yIjpbInB3ZCJdfQ.RJ2556MHIUe_4nJ2zJ84jOka1TFmBuChGMxiXB6naHsrrqoTtYW2qjv6aC4izOj8NBC5e_1AAl5W6b8aGJUmPL7FQguRDla1mC1mY9G_hlb3PikJl4ZfDxCCBBQ4kXJ4yThVsaydbSu8XhWnY7H3YpgUDd0QnQNbjegAylFfstNztr1y2WgF6iYDcJ5X1Tx3VcMV0oGPsMSZL8rK9Fo7BWwy5vh774BhPYDlZWjj7Vo8h2J6VnRZIjSPATkA46kg7XqERpX-XtB-_6Jz22jeCVbLd5Hu5YKPaWhAxszS8L-Fc-pJJU8VvRhAH3DnBz0jyPjQZFVmcxfm4-Ew5TvECQ\",\"profile\":{\"s_hash\":\"_pTU7c8cqJsk-bsk7mLcBQ\",\"sid\":\"D25E59CB17D4D41D10200A09E5B22087\",\"sub\":\"78f29fea-da5c-4d91-918c-84f1d656fa6f\",\"auth_time\":1603283622,\"idp\":\"local\",\"amr\":[\"pwd\"],\"displayname\":\"Supervisor\",\"name\":\"testuser\",\"email\":\"[email protected]\"},\"isAuthenticated\":true}},{\"type\":\"auth/setUser\",\"payload\":{\"token\":\"eyJhbGciOiJSUzI1NiIsImtpZCI6IkY5QkVFMDY3MEEyQzVFQ0QxMDFEQzlGM0EyQjBBOEMwIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2MDMyODUyNzEsImV4cCI6MTYwMzI4ODg3MSwiaXNzIjoiaHR0cHM6Ly9hY2NvdW50cy50eHMuZGUiLCJhdWQiOiJ0cmF2b3hBcGkiLCJjbGllbnRfaWQiOiJ0cmF2b3giLCJzdWIiOiI3OGYyOWZlYS1kYTVjLTRkOTEtOTE4Yy04NGYxZDY1NmZhNmYiLCJhdXRoX3RpbWUiOjE2MDMyODM2MjIsImlkcCI6ImxvY2FsIiwiZGlzcGxheW5hbWUiOiJTdXBlcnZpc29yIiwicm9sZSI6IlN1cGVydmlzb3IiLCJuYW1lIjoiYWRtaW4iLCJlbWFpbCI6ImFkbWluQHR4cy5kZSIsImp0aSI6IkE0QTM4Qjc0NTBDMTVCNkNCRkYyQTM1NjIwRjBBQjI0Iiwic2lkIjoiRDI1RTU5Q0IxN0Q0RDQxRDEwMjAwQTA5RTVCMjIwODciLCJpYXQiOjE2MDMyODUyNzEsInNjb3BlIjpbIm9wZW5pZCIsInRyYXZveFByb2ZpbGUiLCJ0cmF2b3hBcGkiXSwiYW1yIjpbInB3ZCJdfQ.hcgFiRoSk0Pl5CrF4aOSMkdN7K2BOl6DXWwMwg4GTLmfYHoAMcTEDmj9KyNNK51u4qsJ7jiQDnPpE7CUWeAlOmh4X3Vz-Qjhtl0LuPyPlRsEUOMEtq5FHNDo3t2jkbYHrwzcGwiO3_ncnAnKLvU7pnDCxM8jcObluMngHe7Zm_qx3CNBc0N8GRluZPm4tqHAYTHwf5wX4lupmBb8T7U_T4y9gEtvJvMxklXpo_kJn9tA0SiKI3fRyZv4vCR8JZzp1aXGqhMnn-z5mM50pwGoICNrAMAdBtSnTRVbuTx-8MpaSsoXwDmQWT8zazmkChSpT88ztn_9Wb6k8-QiDy_Vhg\",\"profile\":{\"s_hash\":\"_lWzbvCWcr2E8w1shrozyw\",\"sid\":\"D25E59CB17D4D41D10200A09E5B22087\",\"sub\":\"78f29fea-da5c-4d91-918c-84f1d656fa6f\",\"auth_time\":1603283622,\"idp\":\"local\",\"amr\":[\"pwd\"],\"displayname\":\"Supervisor\",\"name\":\"testuser\",\"email\":\"[email protected]\"},\"isAuthenticated\":true}},{\"type\":\"auth/setUser\",\"payload\":{\"token\":\"eyJhbGciOiJSUzI1NiIsImtpZCI6IkY5QkVFMDY3MEEyQzVFQ0QxMDFEQzlGM0EyQjBBOEMwIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2MDMyODUyNzEsImV4cCI6MTYwMzI4ODg3MSwiaXNzIjoiaHR0cHM6Ly9hY2NvdW50cy50eHMuZGUiLCJhdWQiOiJ0cmF2b3hBcGkiLCJjbGllbnRfaWQiOiJ0cmF2b3giLCJzdWIiOiI3OGYyOWZlYS1kYTVjLTRkOTEtOTE4Yy04NGYxZDY1NmZhNmYiLCJhdXRoX3RpbWUiOjE2MDMyODM2MjIsImlkcCI6ImxvY2FsIiwiZGlzcGxheW5hbWUiOiJTdXBlcnZpc29yIiwicm9sZSI6IlN1cGVydmlzb3IiLCJuYW1lIjoiYWRtaW4iLCJlbWFpbCI6ImFkbWluQHR4cy5kZSIsImp0aSI6IkE0QTM4Qjc0NTBDMTVCNkNCRkYyQTM1NjIwRjBBQjI0Iiwic2lkIjoiRDI1RTU5Q0IxN0Q0RDQxRDEwMjAwQTA5RTVCMjIwODciLCJpYXQiOjE2MDMyODUyNzEsInNjb3BlIjpbIm9wZW5pZCIsInRyYXZveFByb2ZpbGUiLCJ0cmF2b3hBcGkiXSwiYW1yIjpbInB3ZCJdfQ.hcgFiRoSk0Pl5CrF4aOSMkdN7K2BOl6DXWwMwg4GTLmfYHoAMcTEDmj9KyNNK51u4qsJ7jiQDnPpE7CUWeAlOmh4X3Vz-Qjhtl0LuPyPlRsEUOMEtq5FHNDo3t2jkbYHrwzcGwiO3_ncnAnKLvU7pnDCxM8jcObluMngHe7Zm_qx3CNBc0N8GRluZPm4tqHAYTHwf5wX4lupmBb8T7U_T4y9gEtvJvMxklXpo_kJn9tA0SiKI3fRyZv4vCR8JZzp1aXGqhMnn-z5mM50pwGoICNrAMAdBtSnTRVbuTx-8MpaSsoXwDmQWT8zazmkChSpT88ztn_9Wb6k8-QiDy_Vhg\",\"profile\":{\"s_hash\":\"_lWzbvCWcr2E8w1shrozyw\",\"sid\":\"D25E59CB17D4D41D10200A09E5B22087\",\"sub\":\"78f29fea-da5c-4d91-918c-84f1d656fa6f\",\"auth_time\":1603283622,\"idp\":\"local\",\"amr\":[\"pwd\"],\"displayname\":\"Supervisor\",\"name\":\"testuser\",\"email\":\"[email protected]\"},\"isAuthenticated\":true}},{\"type\":\"dialog/open\",\"payload\":\"DIALOG_UPLOAD_QUARTER\"},{\"type\":\"set/selectedReportingPeriod\",\"payload\":{\"period\":{\"id\":\"2019-Q3\",\"caption\":\"3. Quartal 2019\",\"shortCaption\":\"Q3 19\",\"isActive\":true}}},{\"type\":\"transparency/overviewCharts\",\"payload\":{\"request\":{\"url\":\"/transparency/overviewCharts?reportingPeriod=2019-Q3\"}}},{\"type\":\"dialog/open\",\"payload\":\"errorDialog\"},{\"type\":\"transparency/overviewCharts_ERROR\",\"payload\":{\"message\":\"Network Error\",\"name\":\"Error\",\"stack\":\"Error: Network Error\\n at createError (https://localhost:3000/static/js/0.chunk.js:83403:15)\\n at XMLHttpRequest.handleError (https://localhost:3000/static/js/0.chunk.js:82900:14)\",\"config\":{\"url\":\"/transparency/overviewCharts?reportingPeriod=2019-Q3\",\"headers\":{\"Accept\":\"application/json\",\"x-tenant\":\"localhost\",\"Authorization\":\"Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IkY5QkVFMDY3MEEyQzVFQ0QxMDFEQzlGM0EyQjBBOEMwIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2MDMyODUyNzEsImV4cCI6MTYwMzI4ODg3MSwiaXNzIjoiaHR0cHM6Ly9hY2NvdW50cy50eHMuZGUiLCJhdWQiOiJ0cmF2b3hBcGkiLCJjbGllbnRfaWQiOiJ0cmF2b3giLCJzdWIiOiI3OGYyOWZlYS1kYTVjLTRkOTEtOTE4Yy04NGYxZDY1NmZhNmYiLCJhdXRoX3RpbWUiOjE2MDMyODM2MjIsImlkcCI6ImxvY2FsIiwiZGlzcGxheW5hbWUiOiJTdXBlcnZpc29yIiwicm9sZSI6IlN1cGVydmlzb3IiLCJuYW1lIjoiYWRtaW4iLCJlbWFpbCI6ImFkbWluQHR4cy5kZSIsImp0aSI6IkE0QTM4Qjc0NTBDMTVCNkNCRkYyQTM1NjIwRjBBQjI0Iiwic2lkIjoiRDI1RTU5Q0IxN0Q0RDQxRDEwMjAwQTA5RTVCMjIwODciLCJpYXQiOjE2MDMyODUyNzEsInNjb3BlIjpbIm9wZW5pZCIsInRyYXZveFByb2ZpbGUiLCJ0cmF2b3hBcGkiXSwiYW1yIjpbInB3ZCJdfQ.hcgFiRoSk0Pl5CrF4aOSMkdN7K2BOl6DXWwMwg4GTLmfYHoAMcTEDmj9KyNNK51u4qsJ7jiQDnPpE7CUWeAlOmh4X3Vz-Qjhtl0LuPyPlRsEUOMEtq5FHNDo3t2jkbYHrwzcGwiO3_ncnAnKLvU7pnDCxM8jcObluMngHe7Zm_qx3CNBc0N8GRluZPm4tqHAYTHwf5wX4lupmBb8T7U_T4y9gEtvJvMxklXpo_kJn9tA0SiKI3fRyZv4vCR8JZzp1aXGqhMnn-z5mM50pwGoICNrAMAdBtSnTRVbuTx-8MpaSsoXwDmQWT8zazmkChSpT88ztn_9Wb6k8-QiDy_Vhg\",\"Access-Control-Max-Age\":600},\"baseURL\":\"https://project-develop.azurewebsites.net/api\",\"transformRequest\":[null],\"transformResponse\":[null],\"timeout\":0,\"xsrfCookieName\":\"XSRF-TOKEN\",\"xsrfHeaderName\":\"X-XSRF-TOKEN\",\"maxContentLength\":-1,\"maxBodyLength\":-1,\"cancelToken\":{\"promise\":{},\"reason\":{}},\"method\":\"get\"}},\"error\":true,\"meta\":{\"requestAction\":{\"type\":\"transparency/overviewCharts\",\"payload\":{\"request\":{\"url\":\"/transparency/overviewCharts?reportingPeriod=2019-Q3\"}}}}},{\"type\":\"set/selectedReportingPeriod\",\"payload\":{\"period\":{\"id\":\"2018-Q4\",\"caption\":\"4. Quartal 2018\",\"shortCaption\":\"Q4 18\",\"isActive\":true}}},{\"type\":\"transparency/overviewCharts\",\"payload\":{\"request\":{\"url\":\"/transparency/overviewCharts?reportingPeriod=2018-Q4\"}}},{\"type\":\"dialog/open\",\"payload\":\"errorDialog\"},{\"type\":\"transparency/overviewCharts_ERROR\",\"payload\":{\"message\":\"Network Error\",\"name\":\"Error\",\"stack\":\"Error: Network Error\\n at createError (https://localhost:3000/static/js/0.chunk.js:83403:15)\\n at XMLHttpRequest.handleError (https://localhost:3000/static/js/0.chunk.js:82900:14)\",\"config\":{\"url\":\"/transparency/overviewCharts?reportingPeriod=2018-Q4\",\"headers\":{\"Accept\":\"application/json\",\"x-tenant\":\"localhost\",\"Authorization\":\"Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IkY5QkVFMDY3MEEyQzVFQ0QxMDFEQzlGM0EyQjBBOEMwIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2MDMyODUyNzEsImV4cCI6MTYwMzI4ODg3MSwiaXNzIjoiaHR0cHM6Ly9hY2NvdW50cy50eHMuZGUiLCJhdWQiOiJ0cmF2b3hBcGkiLCJjbGllbnRfaWQiOiJ0cmF2b3giLCJzdWIiOiI3OGYyOWZlYS1kYTVjLTRkOTEtOTE4Yy04NGYxZDY1NmZhNmYiLCJhdXRoX3RpbWUiOjE2MDMyODM2MjIsImlkcCI6ImxvY2FsIiwiZGlzcGxheW5hbWUiOiJTdXBlcnZpc29yIiwicm9sZSI6IlN1cGVydmlzb3IiLCJuYW1lIjoiYWRtaW4iLCJlbWFpbCI6ImFkbWluQHR4cy5kZSIsImp0aSI6IkE0QTM4Qjc0NTBDMTVCNkNCRkYyQTM1NjIwRjBBQjI0Iiwic2lkIjoiRDI1RTU5Q0IxN0Q0RDQxRDEwMjAwQTA5RTVCMjIwODciLCJpYXQiOjE2MDMyODUyNzEsInNjb3BlIjpbIm9wZW5pZCIsInRyYXZveFByb2ZpbGUiLCJ0cmF2b3hBcGkiXSwiYW1yIjpbInB3ZCJdfQ.hcgFiRoSk0Pl5CrF4aOSMkdN7K2BOl6DXWwMwg4GTLmfYHoAMcTEDmj9KyNNK51u4qsJ7jiQDnPpE7CUWeAlOmh4X3Vz-Qjhtl0LuPyPlRsEUOMEtq5FHNDo3t2jkbYHrwzcGwiO3_ncnAnKLvU7pnDCxM8jcObluMngHe7Zm_qx3CNBc0N8GRluZPm4tqHAYTHwf5wX4lupmBb8T7U_T4y9gEtvJvMxklXpo_kJn9tA0SiKI3fRyZv4vCR8JZzp1aXGqhMnn-z5mM50pwGoICNrAMAdBtSnTRVbuTx-8MpaSsoXwDmQWT8zazmkChSpT88ztn_9Wb6k8-QiDy_Vhg\",\"Access-Control-Max-Age\":600},\"baseURL\":\"https://project-develop.azurewebsites.net/api\",\"transformRequest\":[null],\"transformResponse\":[null],\"timeout\":0,\"xsrfCookieName\":\"XSRF-TOKEN\",\"xsrfHeaderName\":\"X-XSRF-TOKEN\",\"maxContentLength\":-1,\"maxBodyLength\":-1,\"cancelToken\":{\"promise\":{}},\"method\":\"get\"}},\"error\":true,\"meta\":{\"requestAction\":{\"type\":\"transparency/overviewCharts\",\"payload\":{\"request\":{\"url\":\"/transparency/overviewCharts?reportingPeriod=2018-Q4\"}}}}}]"
}
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.