-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
Chaining promises in version 7+ #93
Comments
+1 |
1 similar comment
+1 |
var promise = new Promise(function (resolve) {
resolve();
});
var then = promise.then;
then(function () {}); // this won't work
promise.then(function () {}); // but this would work fine If you can produce an example of code that fails, I'd be very happy to look into why it fails. |
Thanks, that did the trick. For future readers: in order to do |
no, there should be no need to do that. |
If you could provide an example that demonstrates the failure, it would be incredibly helpful. |
Could you tell me what exactly the failure is when you do |
No exception and it just never resolves. Just wrote a reduced version but that works like you said – so something else must be causing it.. So I am separating things now to find out. Stay tuned. |
Are you interacting with any other promise libraries? Especially libraries like lazy-promise (which inherit from promise as a base class)? |
No. Only thing out of the ordinary is that its populating the array inside Can't reproduce a test case right now and have to run. Either way, think it's unrelated to this lib. Feel free to close the issue. Thanks for your help! |
OK, please post here when you manage to produce a test case. @samuelbeek & @kayvink perhaps one of you can produce an example? If all the promises were Promises/A+ compliant, then there is a bug in this library so I'd very much like to get to the bottom of it. |
@ForbesLindesay unfortunately not, because @danamajid fixed the problem for me too (since we work together). |
It turns out this is (see #99) caused by asap sometimes calling back twice and sometimes not at all. The offending issue is kriskowal/asap#55, which has now been resolved. Updating asap should be sufficient, which should happen automatically if you delete any caches and re-install. I will release an update of promise that requires the latest version of asap though to encourage people to update faster. |
Closing this, given that |
I'm trying to just do a simple chaining of promises, by first pushing promises to an array and then do
Promise.all(array).then(function(results) { console.log(results); })
. This used to work just fine in v6.x, but since upgrading to the latest version, it fails.At the essence, what seems to differ from before is:
Previously this would log:
{ then: [Function] }
Now on version 7.0.1, this results in:
{ _32: 0, _8: null, _89: [] }
Did I miss a change in API or am I messing things up? :)
The text was updated successfully, but these errors were encountered: