Promise.allSettled Result Model

`Promise.allSettled()` waits for every input promise to finish and returns one result object per input. Each result records whether that operation fulfilled or rejected, along with its corresponding value or reason.

`Promise.allSettled()` is useful when the outcome of every asynchronous operation matters, even when some operations fail. Unlike `Promise.all()`, one rejection does not cause the aggregate promise to reject.

The returned promise fulfills with an array whose order matches the input order, regardless of which operation finishes first. Each element has `status: "fulfilled"` with a `value`, or `status: "rejected"` with a `reason`.

The input can contain promises as well as ordinary values; non-promise values are treated as already-fulfilled inputs. The aggregate result itself settles only after all supplied inputs have settled.

For frontend code, this model is useful for independent requests such as loading several optional widgets, where you want successful results while also knowing which requests failed. You should inspect `status` before reading `value` or `reason`.

Key points

Interview questions

What does `Promise.allSettled()` return?

It returns a promise that fulfills with an array describing every input operation. Each array element has a `status` property. A fulfilled operation also has `value`, while a rejected operation has `reason`. The array keeps the same order as the original inputs.

How is `Promise.allSettled()` different from `Promise.all()`?

`Promise.all()` is appropriate when every operation is required to succeed and a rejection should make the combined operation reject. `Promise.allSettled()` is appropriate when each operation should be observed independently. With `allSettled()`, failures are represented as result objects rather than causing the aggregate promise to reject. Both preserve input ordering in their successful aggregate results.

Why can you rely on the order of `Promise.allSettled()` results?

The result array is associated with the original iterable positions rather than the order in which promises finish. An operation that finishes later can therefore appear before one that finished earlier if it was earlier in the input. This lets callers associate each result with its corresponding input by index. Completion timing does not reorder the output.

When would you choose `Promise.allSettled()` in a frontend application?

I would use it when several asynchronous operations are independent and I need to inspect every outcome. For example, a dashboard could request several optional data sources and render successful sections while reporting unavailable sections separately. A failure in one request should not erase information from successful requests. If all requests are mandatory, `Promise.all()` may better express the requirement.