#10836 closed bug (invalid)
$.when().always() only passes results of rejected promises
Reported by: | ryanneufeld | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | 1.next |
Component: | deferred | Version: | 1.7.1rc1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
The behaviour of always() is not what is expected. It get's fired every time, however if one of the promises passed does not resolve, none of the successful data is passed to the callback. Instead a workaround/duck punch of using .pipe() is required.
http://jsfiddle.net/ryanneufeld/xRWDc/7/ -- Current behaviour
http://jsfiddle.net/ryanneufeld/xRWDc/8/ -- duck punched w/ .pipe()
pipe() is serving its purpose here, however always should be getting the resolved values and the rejected values. This would allow for a semantic coding style of rejecting and resolving deferreds while giving developers to write a single function to deal with all the results.
Change History (3)
comment:1 Changed 11 years ago by
Component: | unfiled → deferred |
---|---|
Milestone: | None → 1.next |
Priority: | undecided → high |
Status: | new → open |
Version: | git → 1.7.1rc1 |
comment:2 Changed 11 years ago by
Resolution: | → invalid |
---|---|
Status: | open → closed |
You can't generalize this behaviour.
The Promise returned by $.when is rejected if and _as soon as_ one of the joined Promises is rejected. This is needed because you can't assume the other Promises will actually get resolved or rejected: http://jsfiddle.net/2LgZG/
What you want is something else than $.when with semantics that involve none of the passed Promises stay in the pending state.
Confirmed. Maybe this should be considered for 1.7.1.