Skip to content

feat(dev): report why the dev server reloaded or restarted - #1402

Merged
danielroe merged 4 commits into
mainfrom
feat/dev-restart-reasons
Jul 27, 2026
Merged

feat(dev): report why the dev server reloaded or restarted#1402
danielroe merged 4 commits into
mainfrom
feat/dev-restart-reasons

Conversation

@danielroe

Copy link
Copy Markdown
Member

🔗 Linked issue

📚 Description

this improves DX by saying why nuxt is restarting/reloading

@pkg-pr-new

pkg-pr-new Bot commented Jul 27, 2026

Copy link
Copy Markdown
  • nuxt-cli-playground

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

commit: f9a53e5

@codspeed-hq

codspeed-hq Bot commented Jul 27, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing feat/dev-restart-reasons (f9a53e5) with main (678348a)

Open in CodSpeed

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The dev server now uses typed restart reasons for configuration changes, hooks, shortcuts, removed build output, and errors. Reasons are merged during debounced reloads, formatted with relative file paths, and propagated through watchers, IPC messages, restart events, and CLI APIs. Forked and in-process restart paths forward structured reasons, while error handling converts unknown rejection values into messages. Unit and end-to-end tests cover formatting, merging, and shortcut reload invocation.

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

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 31.58% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly matches the main change: reporting why the dev server reloaded or restarted.
Description check ✅ Passed The description is directly related to the change and explains the DX improvement.
✨ 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 feat/dev-restart-reasons

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/reason.ts`:
- Around line 56-60: Update the action text in the reason-formatting logic to
return “Reloading Nuxt in place...” for non-hard restarts, while preserving
“Restarting Nuxt in a new process” for hard restarts and the existing
formatRestartCause handling.
🪄 Autofix (Beta)

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: 76a500cb-7fea-468b-baa1-4e5f9304ea79

📥 Commits

Reviewing files that changed from the base of the PR and between 747c898 and f8c5083.

📒 Files selected for processing (7)
  • packages/nuxt-cli/src/commands/dev.ts
  • packages/nuxt-cli/src/dev/index.ts
  • packages/nuxt-cli/src/dev/reason.ts
  • packages/nuxt-cli/src/dev/utils.ts
  • packages/nuxt-cli/src/utils/paths.ts
  • packages/nuxt-cli/test/e2e/dev-restart.spec.ts
  • packages/nuxt-cli/test/unit/restart-reason.spec.ts

Comment on lines +56 to +60
const action = options.hard ? 'Restarting Nuxt in a new process' : 'Reloading Nuxt'
if (!reason) {
return `${action}...`
}
return `${formatRestartCause(reason, options)}. ${action}...`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Restore the in-place action text.

This returns Reloading Nuxt..., while the new tests expect Reloading Nuxt in place...; both assertions will fail.

Proposed fix
-  const action = options.hard ? 'Restarting Nuxt in a new process' : 'Reloading Nuxt'
+  const action = options.hard ? 'Restarting Nuxt in a new process' : 'Reloading Nuxt in place'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const action = options.hard ? 'Restarting Nuxt in a new process' : 'Reloading Nuxt'
if (!reason) {
return `${action}...`
}
return `${formatRestartCause(reason, options)}. ${action}...`
const action = options.hard ? 'Restarting Nuxt in a new process' : 'Reloading Nuxt in place'
if (!reason) {
return `${action}...`
}
return `${formatRestartCause(reason, options)}. ${action}...`
🤖 Prompt for 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.

In `@packages/nuxt-cli/src/dev/reason.ts` around lines 56 - 60, Update the action
text in the reason-formatting logic to return “Reloading Nuxt in place...” for
non-hard restarts, while preserving “Restarting Nuxt in a new process” for hard
restarts and the existing formatRestartCause handling.

@danielroe
danielroe force-pushed the feat/dev-restart-reasons branch from f225f50 to 975d980 Compare July 27, 2026 12:00
@danielroe danielroe changed the title feat(dev): always report why the dev server reloaded or restarted feat(dev): report why the dev server reloaded or restarted Jul 27, 2026
@danielroe
danielroe merged commit f6ebadd into main Jul 27, 2026
19 checks passed
@danielroe
danielroe deleted the feat/dev-restart-reasons branch July 27, 2026 12:33
@github-actions github-actions Bot mentioned this pull request Jul 27, 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