I have the following piece of code
Promise.allSettled([
foo(a), // expected to resolve
foo(b), // expected to be rejected
])
.then((results) => {
return results // one resolved and one rejected
})
results
ends up with a rejected promise and a resolved promise.
However, if I change up the order of the promises, I get 2 rejected promises
Promise.allSettled([
foo(b), // expected to be rejected
foo(a), // expected to resolve
])
.then((results) => {
return results // both rejected promises
})
Is this expected behavior? Ideally, I’d like to get one resolved promise regardless of the order of the promises