fix(rsc): group client chunks by server-entry ownership#13880
Conversation
Merging this PR will improve performance by 3.26%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Simulation | rust@create_full_hash |
6.2 ms | 6 ms | +3.26% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing rsc-client-component-code-splitting (2563cf5) with main (896b9ce)
Footnotes
-
25 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
e681001 to
ad89228
Compare
📦 Binary Size-limit
❌ Size increased by 31.88KB from 61.96MB to 61.99MB (⬆️0.05%) |
Rsdoctor Bundle Diff Analysis
Found 6 projects in monorepo, 2 projects with changes. 📊 Quick Summary
📋 Detailed Reports (Click to expand)📁 popular-libsPath:
📦 Download Diff Report: popular-libs Bundle Diff 📁 ui-componentsPath:
📦 Download Diff Report: ui-components Bundle Diff Generated by Rsdoctor GitHub Action |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 007cffa1a0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 34d0cdf0a6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
This PR updates the RSC plugin to group client component chunks by root/server-entry ownership instead of always emitting one async chunk per client boundary, and expands fixtures/snapshots to cover the new grouping behavior.
Changes:
- Tracks root-owned and server-entry-owned client imports during RSC graph traversal.
- Injects grouped RSC entry async blocks for root and per-server-entry client modules, with updated debug comments.
- Adds a comprehensive
client-chunk-groupingconfig case and updates the debug-comments fixture.
Reviewed changes
Copilot reviewed 44 out of 44 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
crates/rspack_plugin_rsc/src/component_info.rs |
Tracks client imports by root and server-entry ownership. |
crates/rspack_plugin_rsc/src/server_plugin.rs |
Groups collected client imports into root, server-entry, and ungrouped buckets. |
crates/rspack_plugin_rsc/src/client_plugin.rs |
Injects grouped RSC client entry dependencies. |
crates/rspack_plugin_rsc/src/rsc_entry_module.rs |
Builds grouped async blocks and updates debug comment rendering. |
crates/rspack_plugin_rsc/src/rsc_entry_dependency.rs |
Carries grouped client module data through the dependency. |
crates/rspack_plugin_rsc/src/rsc_entry_module_factory.rs |
Passes grouped dependency data into RscEntryModule. |
crates/rspack_plugin_rsc/src/plugin_state.rs |
Stores grouped client entry state. |
crates/rspack_plugin_rsc/src/utils.rs |
Reuses precomputed module resources for CSS detection. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/rspack.config.js |
Adds manifest and emitted-CSS assertions for grouping. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/test.config.js |
Configures the new config case bundle. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/src/Root.js |
Adds root RSC fixture. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/src/framework/entry.client.js |
Adds client compiler fixture entry. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/src/framework/entry.rsc.js |
Adds RSC render/test entry. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/src/framework/entry.ssr.js |
Adds SSR fixture entry. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/src/pages/PageOne.js |
Adds first server-entry page fixture. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/src/pages/PageOne.css |
Adds first page server CSS marker. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/src/pages/PageTwo.js |
Adds second server-entry page fixture. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/src/pages/PageTwo.css |
Adds second page server CSS marker. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/src/clients/PageOneClientA.js |
Adds page-one-owned client fixture. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/src/clients/PageOneClientA.css |
Adds CSS marker for page-one client A. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/src/clients/PageOneClientB.js |
Adds page-one-owned client fixture. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/src/clients/PageOneClientB.css |
Adds CSS marker for page-one client B. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/src/clients/PageTwoClient.js |
Adds page-two-owned client fixture. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/src/clients/PageTwoClient.css |
Adds CSS marker for page-two client. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/src/clients/RootOnlyA.js |
Adds root-only client fixture. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/src/clients/RootOnlyA.css |
Adds CSS marker for root client A. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/src/clients/RootOnlyB.js |
Adds root-only client fixture. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/src/clients/RootOnlyB.css |
Adds CSS marker for root client B. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/src/clients/SharedAcrossPages.js |
Adds multi-server-entry shared client fixture. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/src/clients/SharedAcrossPages.css |
Adds CSS marker for page-shared client. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/src/clients/SharedRootAndPage.js |
Adds root/server-entry shared client fixture. |
tests/rspack-test/configCases/rsc-plugin/client-chunk-grouping/src/clients/SharedRootAndPage.css |
Adds CSS marker for root/page-shared client. |
tests/rspack-test/configCases/rsc-plugin/rsc-entry-debug-comments/src/App.js |
Updates debug fixture root to exercise ownership groups. |
tests/rspack-test/configCases/rsc-plugin/rsc-entry-debug-comments/src/Client.js |
Removes old single-client fixture. |
tests/rspack-test/configCases/rsc-plugin/rsc-entry-debug-comments/src/clients/PageOneClient.js |
Adds page-one client fixture. |
tests/rspack-test/configCases/rsc-plugin/rsc-entry-debug-comments/src/clients/PageTwoClient.js |
Adds page-two client fixture. |
tests/rspack-test/configCases/rsc-plugin/rsc-entry-debug-comments/src/clients/RootClient.js |
Adds root client fixture. |
tests/rspack-test/configCases/rsc-plugin/rsc-entry-debug-comments/src/clients/SharedAcrossPages.js |
Adds shared-across-pages client fixture. |
tests/rspack-test/configCases/rsc-plugin/rsc-entry-debug-comments/src/clients/SharedRootAndPage.js |
Adds root/page shared client fixture. |
tests/rspack-test/configCases/rsc-plugin/rsc-entry-debug-comments/src/pages/PageOne.js |
Adds first server-entry debug fixture page. |
tests/rspack-test/configCases/rsc-plugin/rsc-entry-debug-comments/src/pages/PageOne.css |
Updates CSS selector for page-one fixture. |
tests/rspack-test/configCases/rsc-plugin/rsc-entry-debug-comments/src/pages/PageTwo.js |
Adds second server-entry debug fixture page. |
tests/rspack-test/configCases/rsc-plugin/rsc-entry-debug-comments/src/pages/PageTwo.css |
Adds page-two CSS fixture. |
tests/rspack-test/configCases/rsc-plugin/rsc-entry-debug-comments/__snapshot__/rsc-entry-debug-comments.txt |
Updates expected grouped debug comments. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 68434fed5a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 930fe2aa73
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
use clientmodules by RSC ownership instead of always creating one async chunk per client boundary.use server-entrysubtree into the same chunk group as that server-entry's CSS.Related links
Checklist