-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
Suggestion: Warn when bindActionCreators encounters non-function property #2279
Conversation
Seems reasonable to me. Anyone else have any input? |
Seems reasonable. (Also, I should actually read prior comments more carefully so I don't sound like I'm just parroting someone else :) ) |
OK, let's merge it in. |
I think the automatic filtering was quite convenient for projects where you define both action creators and action types in the same file and then do This usage pattern is also used in the official container.js:
actions.js:
Not sure if that approach is considered outdated, but at least I use it in my project a lot and it's still described in the official docs. The not so pretty workaround I use now in my project:
|
I updated the redux to 3.7.0 and got the error:
Tell me how to fix it? Have any ideas? |
I found the warning a source of some problems or misunderstanding. I replied some questions related. Since the application code continues working as expected (at least in my usecase), could be helpful if the the warning is a |
Try this
|
I have to agree with @sebcode. Importing in actions with
Now I get that you could export out of your actions files differently or add a little util function (like @sebcode is using) to pull out any non-function values pulled in with |
@artgillespie any possibility of reverting this? The error is super annoying. |
this merge is really a bad idea. |
@markerikson @gaearon What do you think? This seems to be getting a lot of people in trouble with how Babel puts extra properties on modules ( |
Well, on the one hand, it is just a warning. On the other hand, it does seem to clash with how Babel currently works, and our own samples show the usage pattern that leads to that warning. Given that (I'm also still seeing pros and cons for having filtering for only functions in stuff like |
I think that at least a warn instead of error message on the console would better suit this situation. When I saw the error msg I expected that my code was broke and things related to the error wasn't working, turns out it's just a warning, actually. |
Agree that downgrading to a warning will be better but this should really just be reverted :-/ |
Wait, our Anyways, I'll look at getting this change reverted shortly. I need to switch laptops, but I'll do that tonight. |
Running tests with Jest will see it as a console.error:
|
OP here... I'll get the revert PR together now. Sorry for all the trouble. |
…roperty (reduxjs#2279)" This reverts commit 1b154e0.
…roperty (reduxjs#2279)" This reverts commit 1b154e0.
Reverted and pushed out in 3.7.1. Thanks for the feedback everyone! |
Sorry I didn't chime in on this. That's exactly the reason we didn't do this in the first place 😛 |
Even filtering |
…roperty (reduxjs#2279)" (reduxjs#2473) This reverts commit 1b154e0.
I've found myself debugging 'Dude, where's my prop?' situations when I've done something like
It would speed up debugging in these situations if
bindActionCreators
logged a warning when it's passed an object with non-function properties.