Problem
In dev, server-code changes trigger rsc:update, and the client re-fetches the RSC payload from devMainRscPath (fetchRscPayload in packages/static/src/client/entry.tsx). The server handler for that path (serveRSC in packages/static/src/rsc/entry.tsx) always renders entries[0]:
// Use the first entry for HMR re-fetch
const entry = entries[0];
(The nearby comment claims "single-entry mode or index.html entry", but the code doesn't even fall back to index.html — it's always the first entry.)
With multiple entries this means: editing server code while viewing any non-first page replaces the page content with the first entry's tree. Note that this affects every fs-routes app, since fs-routes produces one entry per page.
Suggested fix
Include the current page's path in the re-fetch request (e.g. a query parameter with location.pathname), and resolve it server-side with the existing findEntryForUrlPath (plus the same SPA fallback as serveHTML).
An e2e test in e2e/tests-dev/ covering HMR on a non-first entry of the multi-entry fixture would lock this in.
Found during a framework audit.
Problem
In dev, server-code changes trigger
rsc:update, and the client re-fetches the RSC payload fromdevMainRscPath(fetchRscPayloadinpackages/static/src/client/entry.tsx). The server handler for that path (serveRSCinpackages/static/src/rsc/entry.tsx) always rendersentries[0]:(The nearby comment claims "single-entry mode or index.html entry", but the code doesn't even fall back to
index.html— it's always the first entry.)With multiple entries this means: editing server code while viewing any non-first page replaces the page content with the first entry's tree. Note that this affects every fs-routes app, since fs-routes produces one entry per page.
Suggested fix
Include the current page's path in the re-fetch request (e.g. a query parameter with
location.pathname), and resolve it server-side with the existingfindEntryForUrlPath(plus the same SPA fallback asserveHTML).An e2e test in
e2e/tests-dev/covering HMR on a non-first entry of the multi-entry fixture would lock this in.Found during a framework audit.