Skip to content

Conversation

@kekekuli
Copy link
Contributor

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

Fixes nodejs/node#58000

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 10:03
@vercel
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 24, 2025 10:04am

@kekekuli kekekuli changed the title fix: improve 'Understanding process.nextTick()' page example code. fix(learn): improve 'Understanding process.nextTick()' doc page example code. Apr 24, 2025
```

The exact output may differ from run to run.
The exact output may differ from run to run. [setImmediate vs setTimeout](https://nodejs.org/en/learn/asynchronous-work/event-loop-timers-and-nexttick#setimmediate-vs-settimeout) explain the reason.
Copy link
Member

Choose a reason for hiding this comment

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

Honestly, at this point, maybe replace the whole section with a summary of why the order is the way it is, and then link to the more detailed explanation.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.61%. Comparing base (0b24039) to head (e5a3b87).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7679      +/-   ##
==========================================
- Coverage   74.63%   74.61%   -0.03%     
==========================================
  Files          96       96              
  Lines        7689     7689              
  Branches      192      192              
==========================================
- Hits         5739     5737       -2     
- Misses       1948     1950       +2     
  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.

@kekekuli kekekuli closed this Apr 24, 2025
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.

Example code in 'Understanding process.nextTick()' page have un-clear explanation for output

3 participants