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

combineReducer should give warning if a reducer is not a function #3027

Closed
baibhavx opened this issue Jun 15, 2018 · 1 comment
Closed

combineReducer should give warning if a reducer is not a function #3027

baibhavx opened this issue Jun 15, 2018 · 1 comment

Comments

@baibhavx
Copy link

baibhavx commented Jun 15, 2018

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

  • Feature

What is the current behavior?

  • If the object supplied to combineReducer has a key whose value is not a function, it simply ignores it.
const rootReducer = combineReducers({ 
  todos: todosReducer, 
  steps: {} // no warning, this is simply ignored 
})

What is the expected behavior?

  • It should give a warning, letting the user know that each key should point to a reducer function.

Please check out this pull-request with proposed changes: #3026

I will be more than happy to write a test case for this feature.

@baibhavx baibhavx changed the title combineReducer combineReducer should give warning if a reducer is not a function Jun 15, 2018
@timdorr
Copy link
Member

timdorr commented Jun 16, 2018

I actually found the reason we can't do that: #124

Unfortunately, because of how Babel can transpile modules, you easily end up with extraneous properties going into your export object (e.g., import * as Reducers from './reducers' will have an _esModule property). While not a problem by the specification, it's a practical issue users will run into.

We had the exact same issue with #2279 and had to back out those changes too. Unfortunately, this is still something we need to handle.

@timdorr timdorr closed this as completed Jun 16, 2018
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