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

Add a warning for undefined properties passed to combineReducers #1789

Merged
merged 4 commits into from
Jul 19, 2016

Conversation

borkxs
Copy link
Contributor

@borkxs borkxs commented Jun 3, 2016

This is easy to accidentally do with import statements and combineReducers doesn't currently give any indication of anything going wrong, it just ignores properties that aren't functions.

// forgot to export
const thing = (state, action) => ...
import {thing} from "../actions/thing"

combineReducers({
  thing
})

if (typeof reducers[key] === 'undefined') {
warning(`No reducer provided for key "${key}"`)
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Do you mind adding newlines before and after this new block? It makes it easier to spot the dev-only code.

@timdorr
Copy link
Member

timdorr commented Jul 19, 2016

LGTM once we can get the style fixed up.

@borkxs
Copy link
Contributor Author

borkxs commented Jul 19, 2016

Newlines added. 👍

@timdorr
Copy link
Member

timdorr commented Jul 19, 2016

Thanks! I'll tweak some of the messaging after-the-fact.

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

Successfully merging this pull request may close these issues.

2 participants