Course contentsShow
← JavaScript
Lesson 1313 of 2,72329. PromisesFree lesson

Use Cases for allSettled

Identify scenarios where you need all outcomes regardless of success or failure.

Use Cases for allSettled

What you'll learn: When and why to choose Promise.allSettled() over other Promise combinators in real-world scenarios.

The Core Idea

Promise.allSettled() shines when you need complete visibility into multiple async operations, regardless of whether they succeed or fail. Unlike Promise.all(), which short-circuits on the first rejection, allSettled() waits patiently for every promise to finish and gives you a full report.

When to Use allSettled()

Independent Operations
When you're running multiple tasks that don't depend on each other, and one failure shouldn't stop the others. Think of sending notifications to multiple users—if one email fails, you still want to know which ones succeeded.

Audit Trails and Reporting
When you need to log or report on every outcome. Imagine a batch job processing 100 files: you want to know exactly which 87 succeeded and which 13 failed, not just "something went wrong."

Graceful Degradation
When you're fetching data from multiple sources and want to use whatever succeeds. For example, loading user preferences from three different services—you'll use whichever ones respond, and handle missing data gracefully.

Cleanup and Finalization
When you need to perform cleanup actions based on all results. Perhaps you're running multiple database migrations and need to generate a summary report showing which succeeded, which failed, and why.

Real-World Analogy

Think of Promise.allSettled() like sending invitations to a party. You don't cancel the party if some people decline—you just want to know the final headcount: who's coming (fulfilled) and who can't make it (rejected).

Key Takeaway: Use Promise.allSettled() when you need comprehensive results from multiple independent operations, where failures shouldn't prevent you from seeing what succeeded—ideal for reporting, auditing, and graceful degradation scenarios.