Skip to content

perf(dev): stop saves that change nothing from restarting the dev server - #1435

Merged
danielroe merged 2 commits into
mainfrom
perf/restarts
Aug 9, 2026
Merged

perf(dev): stop saves that change nothing from restarting the dev server#1435
danielroe merged 2 commits into
mainfrom
perf/restarts

Conversation

@danielroe

Copy link
Copy Markdown
Member

🔗 Linked issue

📚 Description

this avoids too-eager restarts of nuxt cli

@pkg-pr-new

pkg-pr-new Bot commented Aug 9, 2026

Copy link
Copy Markdown
  • nuxt-cli-playground

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

commit: 9515b53

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 142a4c4c-9cb9-478d-af66-a83d5f37ca69

📥 Commits

Reviewing files that changed from the base of the PR and between 3a4553d and 9515b53.

📒 Files selected for processing (1)
  • packages/nuxt-cli/src/dev/utils.ts

📝 Walkthrough

Walkthrough

FileChangeTracker now uses SHA-1 content hashes for files up to 256 KiB and retains modification-time tracking for directories, larger files, and hash failures. Identical rewrites no longer emit changes. The new perFile helper debounces events independently by path and cancels pending callbacks during watcher cleanup. Root and .config watchers use this helper. Tests cover hashing, atomic saves, oversized files, event coalescing, and cancellation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states that unchanged saves will no longer restart the development server.
Description check ✅ Passed The description directly explains that the changes prevent overly eager Nuxt CLI development server restarts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perf/restarts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/nuxt-cli/src/dev/utils.ts`:
- Around line 110-115: Update hashFileContents to read through a file descriptor
with a buffer limited to MAX_HASHED_FILE_SIZE + 1 bytes instead of reading the
entire file via readFileSync. If the extra byte is present, return the existing
mtime-based fallback; otherwise hash only the bytes read, while preserving the
current size guard and error handling.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b3b51cd3-ed7c-45e3-96f5-e72afa4f2997

📥 Commits

Reviewing files that changed from the base of the PR and between 585278a and 3a4553d.

📒 Files selected for processing (3)
  • packages/nuxt-cli/src/dev/utils.ts
  • packages/nuxt-cli/test/unit/file-watcher.spec.ts
  • packages/nuxt-cli/test/unit/per-file.spec.ts

Comment thread packages/nuxt-cli/src/dev/utils.ts Outdated
@codspeed-hq

codspeed-hq Bot commented Aug 9, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing perf/restarts (9515b53) with main (585278a)

Open in CodSpeed

@danielroe
danielroe added this pull request to the merge queue Aug 9, 2026
Merged via the queue into main with commit 57da795 Aug 9, 2026
19 checks passed
@danielroe
danielroe deleted the perf/restarts branch August 9, 2026 09:11
@github-actions github-actions Bot mentioned this pull request Aug 9, 2026
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.

1 participant