Skip to content

is there a way to turn off Unexpected key warning in combineReducers #2572

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

Closed
magicdawn opened this issue Aug 20, 2017 · 1 comment
Closed

Comments

@magicdawn
Copy link
Contributor

magicdawn commented Aug 20, 2017

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?

@timdorr
Copy link
Member

timdorr commented Aug 20, 2017

Mark had a good response to this: #2427 (comment)

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.

@timdorr timdorr closed this as completed Aug 20, 2017
@reduxjs reduxjs deleted a comment from dr-azbest Jan 17, 2020
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

2 participants