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

combineReducers does not remove unexpected keys when reducers have no changes #1748

Closed
gwwar opened this issue May 19, 2016 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@gwwar
Copy link

gwwar commented May 19, 2016

For example in the following, I would expect newState to equal { id: 1234, name: 'hello' } but it instead returns currentState.

const currentState = { id: 1234, name: 'hello', unexpected: 4567 };
const reducer = combineReducers( { id, name } );
const newState = reducer( currentState, {} );

The additional key is harmless in code, but it is annoying since an error warning may be printed to console repeatedly. This case is pretty easy to run into if the redux tree is persisted and the data shape changes.

@gaearon gaearon added the bug Something isn't working label May 19, 2016
@gaearon
Copy link
Contributor

gaearon commented May 19, 2016

Good point. This should be easy to fix. Would you like to take a stab at it?

@gaearon
Copy link
Contributor

gaearon commented May 26, 2016

For now, let’s do something different. I propose we keep a cache for properties we warned about in development, and don’t warn about them the second time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants