Skip to content

fix: resolve current entry for dev HMR re-fetch in multi-entry mode#157

Merged
uhyo merged 1 commit into
masterfrom
claude/issue-140-4mzveg
Jul 19, 2026
Merged

fix: resolve current entry for dev HMR re-fetch in multi-entry mode#157
uhyo merged 1 commit into
masterfrom
claude/issue-140-4mzveg

Conversation

@uhyo

@uhyo uhyo commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Problem

In dev, server-code changes trigger rsc:update and the client re-fetches the RSC payload from devMainRscPath. The server handler (serveRSC) always rendered entries[0], so with multiple entries, editing server code while viewing any non-first page replaced the page content with the first entry's tree. This affected every fs-routes app, since fs-routes produces one entry per page.

Fix

  • Client (src/client/entry.tsx): the HMR re-fetch now includes the current page path as a path query parameter.
  • Server (src/rsc/entry.tsx): serveRSC resolves that path with the existing findEntryForUrlPath plus the same SPA fallback as serveHTML (extracted into a shared resolveEntryForUrlPath helper). If no path parameter is provided, it falls back to the first entry as before.

Tests

Added an e2e test in e2e/tests-dev/multi-entry.spec.ts that loads a non-first entry, edits its server component on disk, and asserts the updated content appears via HMR while the page still shows its own tree (not the first entry's). The multi-entry fixture gained a dedicated hmr-test.html entry so the test's file edits can't interfere with parallel tests.

Verified the test fails against the old behavior and passes with the fix. Build, typecheck, lint, unit tests, and all dev + production e2e suites pass.

Closes #140

🤖 Generated with Claude Code

https://claude.ai/code/session_01VfH2tK77WCGbfh24sU4yRp


Generated by Claude Code

In dev, server-code changes trigger an RSC re-fetch from the client, but
the server handler always rendered the first entry, replacing the
current page's content with the first entry's tree when viewing any
other page (which affects every fs-routes app).

The client now sends the current page path as a query parameter, and
the server resolves it with findEntryForUrlPath plus the same SPA
fallback as serveHTML.

Closes #140

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VfH2tK77WCGbfh24sU4yRp
@uhyo
uhyo merged commit 030cb08 into master Jul 19, 2026
2 checks passed
@uhyo
uhyo deleted the claude/issue-140-4mzveg branch July 19, 2026 10:11
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.

Multi-entry dev HMR always re-renders the first entry, replacing the current page's content

2 participants