Skip to content

fix(core): preserve options when restarting#8161

Merged
chenjiahan merged 1 commit into
mainfrom
chenjiahan/fix-restart-options
Jul 22, 2026
Merged

fix(core): preserve options when restarting#8161
chenjiahan merged 1 commit into
mainfrom
chenjiahan/fix-restart-options

Conversation

@chenjiahan

Copy link
Copy Markdown
Member

Summary

JavaScript API restarts previously fell back to the default build() or startDevServer() options. This PR snapshots the original options, exposes them through the action-specific RestartContext, and reuses them when the CLI restarts the task. It also updates the related documentation and regression coverage.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Restart contexts now include the options used by the triggering build or development-server operation. Core restart handling preserves these options and adds watched file paths, while CLI restart execution reuses them. The RestartContext type and API documentation were updated accordingly. Unit and end-to-end tests now validate empty options, watched builds, and development-server option preservation.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% 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
Title check ✅ Passed The title clearly matches the main change: preserving restart options in core restart flow.
Description check ✅ Passed The description accurately summarizes the option-preservation fix, restart context changes, and doc/regression updates.
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

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 `@website/docs/en/shared/onRestart.mdx`:
- Line 34: Update the options description in
website/docs/en/shared/onRestart.mdx at line 34 to mention
rsbuild.createDevServer() alongside rsbuild.startDevServer(), clarifying that
only StartDevServerOptions-compatible fields are exposed; apply the equivalent
clarification in website/docs/zh/shared/onRestart.mdx at line 34.
🪄 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

Run ID: 7e62ff10-95b6-4a81-be6c-4ba4aec2b809

📥 Commits

Reviewing files that changed from the base of the PR and between 44805db and ec3d43b.

📒 Files selected for processing (16)
  • e2e/cases/javascript-api/dev-server-restart/index.test.ts
  • e2e/cases/javascript-api/restart-option/index.test.ts
  • e2e/cases/javascript-api/restart-preserve-options/index.test.ts
  • e2e/cases/javascript-api/restart-preserve-options/src/index.js
  • e2e/cases/javascript-api/restart-watch-files/index.test.ts
  • packages/core/src/build.ts
  • packages/core/src/cli/init.ts
  • packages/core/src/createRsbuild.ts
  • packages/core/src/restart.ts
  • packages/core/src/server/devServer.ts
  • packages/core/src/types/hooks.ts
  • packages/core/tests/restartHook.test.ts
  • website/docs/en/api/javascript-api/core.mdx
  • website/docs/en/shared/onRestart.mdx
  • website/docs/zh/api/javascript-api/core.mdx
  • website/docs/zh/shared/onRestart.mdx

Comment thread website/docs/en/shared/onRestart.mdx
@chenjiahan
chenjiahan merged commit 3d2784a into main Jul 22, 2026
7 of 8 checks passed
@chenjiahan
chenjiahan deleted the chenjiahan/fix-restart-options branch July 22, 2026 06:41
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