Skip to content

fix(learn): improve the learn Asynchronous Work doc #7682

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

kekekuli
Copy link

Description

The 'Understanding process.nextTick()' doc have one messy example code and example ouput caused by setImmediate() vs setTimeout(). Example code in that doc saying that setImmediate will always have higher order been executed, which may confused for the readers

Validation

The example code has been reviewed to correctly reflect the behavior of the executed order for both setImmediate and setTimeout.
Reviewers should verify that the updated explanation is both technically correct and clearly communicates. No functional or visual changes—only documentation improvements.

Related Issues

#7681

Check List

  • [Yes] I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • [Yes] I have run npm run format to ensure the code follows the style guide.
  • [Yes] I have run npm run test to check if all tests are passing.
  • [Yes] I have run npx turbo build to check if the website builds without errors.
  • [Yes] I've covered new added functionality with unit tests if necessary.

@kekekuli kekekuli requested a review from a team as a code owner April 24, 2025 14:58
Copy link

vercel bot commented Apr 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Apr 25, 2025 2:30am

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.80%. Comparing base (0b24039) to head (8d9abaf).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7682      +/-   ##
==========================================
+ Coverage   74.63%   74.80%   +0.16%     
==========================================
  Files          96       98       +2     
  Lines        7689     7842     +153     
  Branches      192      197       +5     
==========================================
+ Hits         5739     5866     +127     
- Misses       1948     1974      +26     
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@avivkeller avivkeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should give an example, and then say "Hey, this isn't always the case"

I think we should replace the entire section with a link to where a user can find valid examples / use cases, as I said in my other comment.

@kekekuli
Copy link
Author

kekekuli commented Apr 25, 2025

I don't think we should give an example, and then say "Hey, this isn't always the case"

I think we should replace the entire section with a link to where a user can find valid examples / use cases, as I said in my other comment.

The problem is the behavior of setTimeout vs setImmediate is not the key in the section. May be we can choose one to leave, and choose one to keep.

@kekekuli
Copy link
Author

kekekuli commented Apr 25, 2025

I don't think we should give an example, and then say "Hey, this isn't always the case"
I think we should replace the entire section with a link to where a user can find valid examples / use cases, as I said in my other comment.

The problem is the behavior of setTimeout vs setImmediate is not the key in the section. May be we can choose one to left.
After that, left one link that redirect to the

I don't think we should give an example, and then say "Hey, this isn't always the case"

I think we should replace the entire section with a link to where a user can find valid examples / use cases, as I said in my other comment.

I don't think we should give an example, and then say "Hey, this isn't always the case"

I think we should replace the entire section with a link to where a user can find valid examples / use cases, as I said in my other comment.

Using the event loop documentation as an example to illustrate the behavior of nextTick()—do you think this might be too heavy?

@kekekuli kekekuli closed this Apr 25, 2025
@kekekuli kekekuli reopened this Apr 25, 2025
@avivkeller
Copy link
Member

What I'm saying is:

I think we should remove the entire example. The example isn't accurate, as you said, and we have an entire article dedicated to explaining the order of execution.

Now, if we are removing the example, it would make sense to include a link to its successor, that is, the other article.

@kekekuli
Copy link
Author

What I'm saying is:

I think we should remove the entire example. The example isn't accurate, as you said, and we have an entire article dedicated to explaining the order of execution.

Now, if we are removing the example, it would make sense to include a link to its successor, that is, the other article.

I've removed the example code and replaced it with a link. Let me know if you'd like any changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants