cujojs / when

A solid, fast Promises/A+ and when() implementation, plus other async goodies.
Other
3.44k stars 396 forks source link

promise returned from promise.finally does not resolve #342

Closed jescalan closed 10 years ago

jescalan commented 10 years ago

If you return a promise from promise.finally, it is not given a chance to resolve, and finally returns as if synchronous. Example:

somePromise.finally(function(){
  console.log('running finally');
  otherPromise().tap(console.log); // this does not execute
}).tap(function(){ console.log('done with promise chain'); });
briancavalier commented 10 years ago

Great, thanks for the example! One minor correction, it needs a return:

somePromise.finally(function(){
  console.log('running finally');
  // added return
  return otherPromise().tap(console.log); // this does not execute
}).tap(function(){ console.log('done with promise chain'); });

Working on a fix now!

jescalan commented 10 years ago

:tada:

Ah I'm sorry, too much coffeescript with implicit returns

briancavalier commented 10 years ago

No worries, I figured it was coffeescript ;)