Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect analogy of promise chains resembling a stack in documentation #33788

Closed
Maddily opened this issue May 28, 2024 · 2 comments
Closed
Labels
Content:JS JavaScript docs

Comments

@Maddily
Copy link
Contributor

Maddily commented May 28, 2024

MDN URL

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise

What specific section or headline is this issue about?

Chained Promises

What information was incorrect, unhelpful, or incomplete?

The documentation on the MDN page Promise uses an analogy to describe the behavior of promise chains: "The promises of a chain are nested in one another, but get popped like the top of a stack. The first promise in the chain is most deeply nested and is the first to pop." This analogy is misleading because it inaccurately describes the order in which promises are resolved. A stack follows a Last In, First Out (LIFO) order, while promises in a chain are resolved in a First In, First Out (FIFO) order, more like a queue.

What did you expect to see?

I expected to see a description that accurately reflects the sequential nature of promise chains. A correct explanation would clarify that promises in a chain are executed in the order they are created, with each promise waiting for the previous one to resolve.

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

Suggested Revision:

The promises in a chain are executed in sequence, where each promise waits for the previous one to resolve before continuing. The first promise in the chain is the first to be resolved, and subsequent promises are resolved in the order they appear in the chain.

MDN metadata

Page report details
@Maddily Maddily added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label May 28, 2024
@github-actions github-actions bot added Content:JS JavaScript docs and removed Content:JS JavaScript docs labels May 28, 2024
@Ashish-CodeJourney
Copy link
Contributor

Raised a PR for the same
#33790

Please review, suggestions will be appriciated

@Maddily
Copy link
Contributor Author

Maddily commented May 31, 2024

Thank you everyone for your work on this issue and for the improvements made to the documentation. The changes address the concerns I raised and provide a much clearer explanation. I appreciate the effort put into this.

I'm closing this issue now. Thanks again!

@Maddily Maddily closed this as completed May 31, 2024
@Josh-Cena Josh-Cena added Content:JS JavaScript docs and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:JS JavaScript docs
Projects
None yet
Development

No branches or pull requests

3 participants