test(rsc): HMR e2e for a route component co-located with a server fn (canary for #7618 / vitejs/vite-plugin-react#1248)#7621
Conversation
Adds a dev-mode Playwright lane (playwright.hmr.config.ts + tests-hmr/) and a fixture route (rsc-hmr-serverfn.tsx) that co-locates a createServerFn with the route component, then asserts the component Fast Refreshes on edit. This currently FAILS on main: editing the component only emits an (rsc) hmr update for ?tss-serverfn-split, with no client update. It passes once the upstream plugin-rsc fix lands and the dependency is bumped. Refs TanStack#7618, vitejs/vite-plugin-react#1248
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
hmr is notorously hard to test in CI, so please check out how the would be best if you create multiple routes, one with css modules, one without any css, etc. also please configure this to run in both vite and rsbuild so we ensure both build tool adapters work as expected |
|
@schiller-manuel thank you for the response! I'll see how the test can be updated - in the meantime, I wanted to clarify that the real fix here is vitejs/vite-plugin-react#1248, this PR is really just to highlight the current breakage. Once the fix is merged upstream, the idea is to see the test here turn green — hope that makes sense! btw I checked locally on the rsbuild setup, and rsbuild doesn't seem to have this issue |
Description
Adds a dev-mode HMR e2e for a TanStack Start RSC route whose file co-locates a
createServerFnwith the route component, asserting the component Fast Refreshes on edit (and preserves local state).This is intentionally opened as a draft / CI canary: the test fails on
maintoday because it reproduces a real bug — editing such a route component emits only an(rsc) hmr update …?tss-serverfn-splitwith no client update, so the DOM never changes. It will go green once the upstream@vitejs/plugin-rscfix lands and the dependency is bumped. So the PR's CI status is a direct signal for "is the issue resolved yet?".hotUpdateguard returns[]for any file in the rsc graph that isn't a"use client"boundary — which wrongly catches a genuine client route component co-located with a server fn).What's here
e2e/react-start/rsc/src/routes/rsc-hmr-serverfn.tsx— fixture:createServerFn+ route component (marker + counter) in one file.e2e/react-start/rsc/tests-hmr/rsc-hmr.spec.ts— edits the marker, asserts it updates and the counter survives (HMR, not reload).e2e/react-start/rsc/playwright.hmr.config.ts— a dev-mode Playwright lane (the existing rsc e2e runs the built/prod server, which can't exercise HMR), plus atest:e2e:hmrscript.Needs guidance
The new lane isn't wired into the nx/CI e2e matrix yet — HMR needs a dev server, and the existing dev-mode
hmre2e is non-RSC. Happy to integrate it wherever you'd prefer (extend thehmrsuite to RSC, or register this as its own CI e2e project). Flagging since it won't run in CI as-is.