Skip to content
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

devTools prevents immutable checks from working. #105

Closed
gregthebusker opened this issue Sep 11, 2015 · 2 comments
Closed

devTools prevents immutable checks from working. #105

gregthebusker opened this issue Sep 11, 2015 · 2 comments

Comments

@gregthebusker
Copy link

So I think the issues comes down to recomputeStates in devTools.js Basically because recomputeStates provides a completely new state any check to see if the state has changed for object and arrays will falsely return true. Let me give you an example.

var initialState = {
  mySet: new Set(),
};

var anyAction = (o) => {
  return {
    type: 'something',
  }
};

var reducer = (state=initialState, action) => {
  switch(action.type) {
    case 'something':
      return {
        ...state,
      }
  }
};

// Somewhere in some react component
componentWillReceiveProps(nextProps) {
  if (nextProps.mySet != this.props.mySet) {
    this.props.dispatch(anyAction());
  }
}

Because recomputeStates, builds a new state object, nextProps.mySet will change with every action, thus dispatching anyAction will cause an infinite loop.

@bizangles
Copy link

I have been experiencing this issue, but with the componentDidUpdate method. I assume it's the same problem, though.

@gaearon
Copy link
Contributor

gaearon commented Sep 12, 2015

Please see part 1 of #88 (comment).

@gaearon gaearon closed this as completed Sep 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants