Skip to content

Conversation

markdalgleish
Copy link
Member

No description provided.

Copy link

changeset-bot bot commented Sep 2, 2025

⚠️ No Changeset found

Latest commit: 20afc5a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Comment on lines 16 to 22
? async (req, res) => {
// In dev mode, ensure we load a fresh request handler every request
const rscEntry = await viteDevServer.environments.rsc.runner.import(
"virtual:react-router/unstable_rsc/rsc-entry",
);
return createRequestListener(rscEntry.default)(req, res);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

During dev, currently this does nothing since rsc plugin already includes the same handler in viteDevServer.middlewares. I noticed that it isn't the case in non-rsc framework mode. Should rsc plugin align with it?

// Let user servers handle SSR requests in middleware mode,
// otherwise the Vite plugin will handle the request
if (!viteDevServer.config.server.middlewareMode) {
viteDevServer.middlewares.use(async (req, res, next) => {

(Btw, I noticed there's nothing specific about react router for this custom server setup and I'm thinking to add a same example on rsc plugin vitejs/vite-plugin-react#817)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I just realised this too. I've just pushed an update so we use your built-in dev request handler.

@markdalgleish markdalgleish merged commit 34ee782 into dev Sep 4, 2025
8 checks passed
@markdalgleish markdalgleish deleted the markdalgleish/rsc-framework-middleware-mode branch September 4, 2025 06:06
Copy link
Contributor

github-actions bot commented Sep 9, 2025

🤖 Hello there,

We just published version 7.9.0-pre.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Copy link
Contributor

🤖 Hello there,

We just published version 7.9.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants