isotoma / react-cognito

Library for integrating Facebook React and Amazon Cognito
Apache License 2.0
116 stars 48 forks source link

Error when middleware included with redux-immutable-state-invariant #29

Open nkdevirl opened 6 years ago

nkdevirl commented 6 years ago

I'm new to front end development, so hopefully I'm not wasting anyones time with this.

When I add the following to my createStore and add middleware like below

import {createStore, applyMiddleware} from 'redux';
import rootReducer from '../reducers';
import reduxImmutableStateInvariant from 'redux-immutable-state-invariant';
import thunk from 'redux-thunk';

export default function configureStore(initialState) {

  return createStore(
    rootReducer,
    initialState,
    applyMiddleware(thunk, reduxImmutableStateInvariant())
  );
}

It causes the following error

Invariant Violation: A state mutation was detected between dispatches, in the path cognito.user.pool.client.api.operations.addCustomAttributes.input.defaultValue. This may cause incorrect behavior. (http://redux.js.org/docs/Troubleshooting.html#never-mutate-reducer-arguments)

Is this something I can ignore? the error disappears when I change applyMiddleware to

applyMiddleware(thunk)

HoraceShmorace commented 6 years ago

This is a duplicate of the issue I posted: https://github.com/isotoma/react-cognito/issues/28. react-cognito definitely doesn't work when your store uses applyMiddleware.