Issue
setupCognito doesn't seem to play nicely with Redux's applyMiddleware, resulting in a Redux state mutation error.
Steps to reproduce:
- Import
applyMiddleware from redux.
- Call
createStore, passing a call to applyMiddleware (which can be passed any middleware).
- Call
setupCognito.
Symptom
This results in the following error:
Uncaught Error: A state mutation was detected between dispatches, in the path cognito.userPool.client.api.operations.addCustomAttributes.input.defaultValue. This may cause incorrect behavior. (http://redux.js.org/docs/Troubleshooting.html#never-mutate-reducer-arguments)
at invariant (browser.js:40)
at index.js:53
at Object.dispatch (index.js:14)
at setupCognito (react-cognito.js:1191)
at index.js:16
The error seems triggered by the call to setupCognito.