cli icon indicating copy to clipboard operation
cli copied to clipboard

fix(dev): Prime mtimes cache

Open aroneous opened this issue 2 weeks ago • 5 comments

🔗 Linked issue

Resolves #1135

❓ Type of change

  • [ ] 📖 Documentation (updates to the documentation or readme)
  • [x] 🐞 Bug fix (a non-breaking change that fixes an issue)
  • [ ] 👌 Enhancement (improving an existing functionality)
  • [ ] ✨ New feature (a non-breaking change that adds functionality)
  • [ ] 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

When watching for file/directory changes, prime the FileChangeTracker with initial mtimes of the tracked files, such that if the first notification received for a file is spurious (does not represent an actual change), shouldEmitChange will return 'false'.

Without this, the 'priming' happened via several reloads/restarts, but with the introduction of the ForkPool, the FileChangeTracker cache no longer perists across restarts, never allowing it to become populated. Result: unpredictable restarts.

aroneous avatar Nov 21 '25 19:11 aroneous

📦 Bundle Size Comparison

📈 nuxi

Metric Base Head Diff
Rendered 4454.09 KB 4454.51 KB +0.42 KB (+0.01%)

📈 nuxt-cli

Metric Base Head Diff
Rendered 135.16 KB 135.79 KB +0.63 KB (+0.46%)

➡️ create-nuxt

Metric Base Head Diff
Rendered 2376.50 KB 2376.50 KB 0.00 KB (0.00%)

github-actions[bot] avatar Nov 21 '25 19:11 github-actions[bot]

  • nuxt-cli-playground

    npm i https://pkg.pr.new/create-nuxt@1137
    
    npm i https://pkg.pr.new/nuxi@1137
    
    npm i https://pkg.pr.new/@nuxt/cli@1137
    

commit: 7c3db44

pkg-pr-new[bot] avatar Nov 21 '25 19:11 pkg-pr-new[bot]

Codecov Report

:x: Patch coverage is 90.00000% with 3 lines in your changes missing coverage. Please review. :warning: Please upload report for BASE (main@b04de4f). Learn more about missing BASE report.

Files with missing lines Patch % Lines
packages/nuxi/src/dev/utils.ts 90.00% 3 Missing :warning:
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1137   +/-   ##
=======================================
  Coverage        ?   24.12%           
=======================================
  Files           ?       89           
  Lines           ?     4767           
  Branches        ?      252           
=======================================
  Hits            ?     1150           
  Misses          ?     3585           
  Partials        ?       32           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov-commenter avatar Nov 21 '25 19:11 codecov-commenter

CodSpeed Performance Report

Merging #1137 will not alter performance

Comparing aroneous:fix/1135-mtimes (7c3db44) with main (b04de4f)

Summary

✅ 2 untouched

codspeed-hq[bot] avatar Nov 21 '25 19:11 codspeed-hq[bot]

Fixed Windows-specific issues (yeah, the fix is for Windows in the first place, but I developed in on a Mac for silly reasons). I don't think the remaining test failure is related to this change.

aroneous avatar Nov 21 '25 20:11 aroneous