Merged
Conversation
hi-ogawa
commented
Aug 25, 2025
Comment on lines
+484
to
+486
| return ctx.modules.filter( | ||
| (m) => !(m.id?.includes('?direct') && !m.isSelfAccepting), | ||
| ) |
Contributor
Author
There was a problem hiding this comment.
Fixed by targeting non self-accepting case specifically. This likely means HMR doesn't work for xxx.module.css?url, but let's just postpone dealing with that edge case.
commit: |
Add test cases for client-url.css and server-url.css to cover CSS HMR functionality with URL-based CSS imports, following the same pattern as existing CSS module tests. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull Request Overview
This PR fixes CSS Hot Module Replacement (HMR) issues with ?url query parameters in React Server Components by modifying the module filtering logic in the client environment. The fix prevents unnecessary browser reloads when changing CSS files that use the ?url query.
- Updates the HMR module filtering to allow self-accepting modules with
?directquery - Adds comprehensive test coverage for CSS
?urlimports in both client and server components - Removes manual timestamp-based cache busting since proper HMR now handles it
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/plugin-rsc/src/plugin.ts | Updates HMR filter logic to check isSelfAccepting for modules with ?direct |
| packages/plugin-rsc/examples/basic/src/routes/style-server/server.tsx | Adds CSS ?url import and test elements for server-side testing |
| packages/plugin-rsc/examples/basic/src/routes/style-server/server-url.css | New CSS file for server-side ?url testing |
| packages/plugin-rsc/examples/basic/src/routes/style-client/client.tsx | Adds CSS ?url import and test elements for client-side testing |
| packages/plugin-rsc/examples/basic/src/routes/style-client/client-url.css | New CSS file for client-side ?url testing |
| packages/plugin-rsc/examples/basic/src/routes/css-queries/client.tsx | Removes manual cache busting since HMR now handles it properly |
| packages/plugin-rsc/e2e/basic.test.ts | Adds comprehensive test cases for CSS ?url HMR functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
?urlis not working #772TODO