-
Notifications
You must be signed in to change notification settings - Fork 20.6k
$.when, $.progress and already resolved deferred #1894
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
Comments
No matter now many (N>1) are combined, the last one never gets a progress notification. http://jsbin.com/muhuxireko/1/edit?js,console For reference, the docs say:
Frankly I wouldn't have even expected the combined Deferred to report progress from the individual ones. These kind of situations are probably some of many reasons why standard Promise punted on progress. Others, thoughts? |
@jaubourg any input? |
I cannot properly investigate since I'm travelling until monday. I'll look into it then. |
I think the problem comes from here (deferred.js#L134) : resolveValues[ i ].promise()
.done( updateFunc( i, resolveContexts, resolveValues ) )
.fail( deferred.reject )
.progress( updateFunc( i, progressContexts, progressValues ) ); The progress update should perhaps be done first : resolveValues[ i ].promise()
.progress( updateFunc( i, progressContexts, progressValues ) )
.done( updateFunc( i, resolveContexts, resolveValues ) )
.fail( deferred.reject ); |
I think that's the problem too. Wanna make a PR for this with a nice unit test to boot @nicolashenry? :) |
Is it okay that way? |
Merged! Thank you |
This code :
displays "[1,2,undefined]".
I would expect to have "[1,2,3]" as a result because this behavior with the last notify does not appear to be described in the documentation. If any of the deferred objects is not already resolved, the display is "[1,2,3]".
The text was updated successfully, but these errors were encountered: