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.
Good point. This should be easy to fix. Would you like to take a stab at it?
For now, let鈥檚 do something different. I propose we keep a cache for properties we warned about in development, and don鈥檛 warn about them the second time.
Most helpful comment
For now, let鈥檚 do something different. I propose we keep a cache for properties we warned about in development, and don鈥檛 warn about them the second time.