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
Current behavior of settleAll function is that if some promise throws an error, it is removed from the results array and added to errors array. This way the order of promises is broken and additionally, it's hard to guess, from which promise the errors comes. E.g.
/* As an example, secondPromise() throws an error */const{results: [firstPromiseResult,secondPromiseResult,// it contains thirdPromiseResultthirdPromiseResult,// it is undefined],
errors,// it contains array of single error of the second promise}=awaitsettleAll([firstPromise(),secondPromise(),thirdPromise(),]);
To my mind, it would be much more intuitive if the order of resolved promises and errors preserved:
/* As an example, secondPromise() throws an error */const{results: [firstPromiseResult,secondPromiseResult,// it contains null/undefinedthirdPromiseResult,// it contains thirdPromiseResult],
errors,// it contains [null, secondPromiseError, null]}=awaitsettleAll([firstPromise(),secondPromise(),thirdPromise(),]);
The text was updated successfully, but these errors were encountered:
Actually I've just checked the documentation and it says that the order should be preserved:
For resolved promises, the result array contains the resolved value at the same index as the promise. For rejected promises, the result array contains the return value of errFn at the same index as the promise.
Hi,
Current behavior of
settleAll
function is that if some promise throws an error, it is removed from theresults
array and added toerrors
array. This way the order of promises is broken and additionally, it's hard to guess, from which promise the errors comes. E.g.To my mind, it would be much more intuitive if the order of resolved promises and errors preserved:
The text was updated successfully, but these errors were encountered: