Redux: is there a way to turn off Unexpected key warning in combineReducers

Created on 20 Aug 2017  路  1Comment  路  Source: reduxjs/redux

Do you want to request a feature or report a bug?

I use reduceReducers https://github.com/acdlite/reduce-reducers to combine multiple top level reducer, and redux.combineReducer to combine multiple partial reducer to a top level reducer

example
https://github.com/magicdawn/redux-standard-reducer/blob/master/test/simple.js#L10-L22
https://github.com/magicdawn/redux-standard-reducer/blob/master/test/simple.js#L89-L95

What is the current behavior?
And I got this warning
Unexpected key "arr" found in previous state received by the reducer. Expected to find one of the known reducer keys instead: "partial1", "partial2". Unexpected keys will be ignored.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar.

What is the expected behavior?
https://github.com/reactjs/redux/blob/master/src/combineReducers.js#L16-L55

should Have a way to turn off this warning. As I see, with help of unexpectedKeyCache, I just get warn once per key. but when I use

combineReducers({ group1: function(){ }, ... })
combineReducers({ group2: function(){ }, ... })

I'll get lots of warning, so I suggest add an option in combineReducers method, and defaults to true, do not influence current behavior and this warning can be turn off.

Which versions of Redux, and which browser and OS are affected by this issue? Did this work in previous versions of Redux?

>All comments

Mark had a good response to this: https://github.com/reactjs/redux/issues/2427#issuecomment-304499200

I would look at some of the other tooling to build reducers, as combineReducers is not meant to be itself combined with other reducers with something like reduce-reducers. This warning is especially helpful for developers getting started with Redux, so we're going to be leaving it in there and not offering the option to disable it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vraa picture vraa  路  3Comments

jbri7357 picture jbri7357  路  3Comments

jimbolla picture jimbolla  路  3Comments

ramakay picture ramakay  路  3Comments

mickeyreiss-visor picture mickeyreiss-visor  路  3Comments