You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using babel to compile ES2015 down, there is a bug that causes the actionContext.executeAction(action, null, callback) to invoke the callback before the async action finishes.
This bug causes the executeMultiple() to ignore the dependency chain and invokes the action before its dependencies are fulfilled.
Expected behavior
Consider the following 2 actions:
functionloadView(context,params={},done){}functioninitViewPage(context,params,done){actionContext.executeAction(loadView,()=>{console.log('This should not be printed.');});}
When executing initViewPage() action, the console log should not be printed since loadView() action never finishes.
Actual behavior
The console log is printed without waiting for the loadView() action to finish(, which should never happen).
Here, the callback for any action is directly invoked if the parameter count for the action is less than 3.
Since we are using babel to compile the ES2015 down, we cannot rely on the <Func>.length property to determine if we have given the action a callback.
For example:
functionloadViews(context,params={},done){}
loadViews.length will be 1 because it is compiled into:
by babel.
A quick way to avoid this bug is to not use the default parameters syntax in the action definition if you are using babel.
Steps to reproduce the behavior
Try the code in the first section in any babel compiled code.
The text was updated successfully, but these errors were encountered:
Kailang
changed the title
[ES2015] context.executeAction(action) invokes the action's callback before the action finishes
[fluxible] context.executeAction(action) invokes the action's callback before the action finishes
Jun 27, 2018
Kailang
changed the title
[fluxible] context.executeAction(action) invokes the action's callback before the action finishes
[fluxible] context.executeAction(action, null, callback) invokes the callback before the async action finishes
Jun 27, 2018
When using babel to compile ES2015 down, there is a bug that causes the actionContext.executeAction(action, null, callback) to invoke the callback before the async action finishes.
This bug causes the executeMultiple() to ignore the dependency chain and invokes the action before its dependencies are fulfilled.
Expected behavior
Consider the following 2 actions:
When executing
initViewPage()
action, the console log should not be printed sinceloadView()
action never finishes.Actual behavior
The console log is printed without waiting for the
loadView()
action to finish(, which should never happen).Information about the Issue
In:
https://github.com/yahoo/fluxible/blob/master/packages/fluxible/utils/callAction.js#L29
Especially, in:
Here, the callback for any action is directly invoked if the parameter count for the action is less than 3.
Since we are using babel to compile the ES2015 down, we cannot rely on the
<Func>.length
property to determine if we have given the action a callback.For example:
loadViews.length
will be1
because it is compiled into:by babel.
A quick way to avoid this bug is to not use the default parameters syntax in the action definition if you are using babel.
Steps to reproduce the behavior
Try the code in the first section in any babel compiled code.
The text was updated successfully, but these errors were encountered: