feat(dev): report why the dev server reloaded or restarted - #1402
Conversation
commit: |
📝 WalkthroughWalkthroughThe 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)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (7)
packages/nuxt-cli/src/commands/dev.tspackages/nuxt-cli/src/dev/index.tspackages/nuxt-cli/src/dev/reason.tspackages/nuxt-cli/src/dev/utils.tspackages/nuxt-cli/src/utils/paths.tspackages/nuxt-cli/test/e2e/dev-restart.spec.tspackages/nuxt-cli/test/unit/restart-reason.spec.ts
| const action = options.hard ? 'Restarting Nuxt in a new process' : 'Reloading Nuxt' | ||
| if (!reason) { | ||
| return `${action}...` | ||
| } | ||
| return `${formatRestartCause(reason, options)}. ${action}...` |
There was a problem hiding this comment.
🎯 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.
| 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.
f225f50 to
975d980
Compare
🔗 Linked issue
📚 Description
this improves DX by saying why nuxt is restarting/reloading