Which project does this relate to?
Start
Describe the bug
When I use the same middleware in a loader and inside a component (useServerFn), I get the following error on HMR:
8:24:07 AM [vite] (client) hmr update /src/styles.css?direct, /src/routes/private/index.tsx, /src/routes/private/index.tsx?tsr-split=component
8:24:07 AM [vite] (ssr) hmr update /@id/virtual:cloudflare/worker-entry, /src/routes/private/index.tsx?tss-serverfn-split, /src/components/UserId.tsx?tss-serverfn-split
[vite] TypeError: Cannot use 'in' operator to search for 'Symbol(TSS_SERVER_FUNCTION_FACTORY)' in undefined
at /Users/sdorra/Desktop/hmr-issue-sec/node_modules/.pnpm/@tanstack+start-client-core@1.168.2/node_modules/@tanstack/start-client-core/src/createServerFn.ts:99:13
at Array.map (<anonymous>)
at fun.middleware (/Users/sdorra/Desktop/hmr-issue-sec/node_modules/.pnpm/@tanstack+start-client-core@1.168.2/node_modules/@tanstack/start-client-core/src/createServerFn.ts:98:18)
at /Users/sdorra/Desktop/hmr-issue-sec/src/routes/private/index.tsx:7:4
at Object.runInlinedModule (workers/runner-worker/index.js:215:4)
at ModuleRunner.directRequest (workers/runner-worker/vite/module-runner:1204:59)
at ModuleRunner.cachedRequest (workers/runner-worker/vite/module-runner:1111:73)
at ModuleRunner.import (workers/runner-worker/vite/module-runner:1061:10)
at HMRClient.fetchUpdate (workers/runner-worker/vite/module-runner:476:21)
at async Promise.all (index 1)
Sometimes the development server becomes unusable and requires a restart. The error occurs only when I change SSR-related code.
Complete minimal reproducer
https://github.com/sdorra/tanstack-start-hmr-issue
Steps to Reproduce the Bug
- Start the application
pnpm run dev
- Visit the application (http://localhost:3000)
- Change the handler of UserId component a few times (
src/components/UserId.tsx)
- Check the server logs for the error
Expected behavior
Hmr works, no error is thrown and the dev server keeps alive.
Screenshots or Videos
No response
Platform
- Router / Start Version: @tanstack/react-start@1.167.65
- OS: macOS
- Browser: Chrome
- Bundler: vite
- Bundler Version: 8.0.11
Additional context
No response
Which project does this relate to?
Start
Describe the bug
When I use the same middleware in a loader and inside a component (
useServerFn), I get the following error on HMR:Sometimes the development server becomes unusable and requires a restart. The error occurs only when I change SSR-related code.
Complete minimal reproducer
https://github.com/sdorra/tanstack-start-hmr-issue
Steps to Reproduce the Bug
pnpm run devsrc/components/UserId.tsx)Expected behavior
Hmr works, no error is thrown and the dev server keeps alive.
Screenshots or Videos
No response
Platform
Additional context
No response