leoasis / redux-immutable-state-invariant

Redux middleware that detects mutations between and outside redux dispatches. For development use only.
MIT License
937 stars 37 forks source link

Doesn't seem to detect reference updates (equal, but not identical) #5

Closed nevir closed 8 years ago

nevir commented 8 years ago
reducer(state = {}, action) {
  // I would expect this to trigger an error, but it doesn't
  state.foo = {};
  return state;
}

One I give it differing values, it does:

let count = 0;
reducer(state = {}, action) {
  // boom
  state.foo = {count: count++};
  return state;
}
leoasis commented 8 years ago

Nice catch, will try to fix it soon

nevir commented 8 years ago

Awesome :)

leoasis commented 8 years ago

@nevir I've pushed some changes to the logic to detect mutations, and this should be fixed. I'll release a new version soon but if you want/need this now you can test with current master. Feel free to reopen if this is still not working!