-
Notifications
You must be signed in to change notification settings - Fork 228
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
callAction has a bad condition | bug #444
Comments
That's odd. Looks like this is the behavior of functions that use default parameters. Let me look in to whether this is new behavior from babel and whether we could treat this as a bug there, since it seems like babel shouldn't be changing the length. |
Opened https://phabricator.babeljs.io/T7377 to follow up with Babel team. |
After further investigation, this may be how ES6 spec works with default parameter values. We may have to find another solution for this internally. |
yes, the current condition is not good |
So the only way to mitigate this that I can see is to check the return value against |
After finding a bug internally that was related to this Anyone using the return value as the resolved value would need to use |
This would basically be just removing that line linked to in the origin comment (https://github.com/yahoo/fluxible/blob/master/packages/fluxible/utils/callAction.js#L29). |
We do have actions without the callback param, that do not use promises, this is functionality that has been in place from the beginning. These actions are mostly doing synchronous logic and/or context.dispatch calls that would not really track callback, we have quite a few of these actions, so any breaking change introduced that removes support for this case would need substantial changes. (just want you to be aware) |
Hi
I found a very strange behaviour. My done callback was very often called twice. The problem is on the next line
fluxible/packages/fluxible/utils/callAction.js
Line 29 in 3863005
I am using babel and babel will transform next action
into the
As you can see transformed action named setAction has just one parameter (original has 3 parameters) and your condition action.length < 3 will be equals true. I think that too many of us are using babel in this moment and can have a same problem.
The text was updated successfully, but these errors were encountered: