DEV Community

Discussion on: You're Probably Not Using Promise.All Enough

Collapse
 
tomyem profile image
Tom-Yem

Good post sam.

Just to add something to it. Promise.all is good for "all or nothing" situations. If one promise rejects, Promise.all immediately rejects, completely forgetting about the other ones in the list. Their results are ignored.

There is also a similar new method, Promise.allSettled, which is good for "all or some" situation.This one waits for all promises to settle, regardless of the result (error or value).

Collapse
 
samjarman profile image
Sam Jarman 👨🏼‍💻

Ah I hadn’t come across allSettled yet! Thanks.