-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Which project does this relate to?
Router
Describe the bug
When using setupRouterSsrQueryIntegration with renderRouterToString the server never responses. It hangs forver.
It seems some promises never resolve, I debugged it a bit, and found that
| onDone: () => p.resolve(''), |
is never resolved.
To verify my thesis, i added a "manuel p.resolve()" in onSerialize() and the server starts working again!
when I add a console log for the content of dehydratedRouter:
I get:
crossSerializeStream start {
manifest: undefined,
matches: [
{ i: '__root__', u: 1758056689675, s: 'success', ssr: true },
{ i: '/', u: 1758056689699, s: 'success', l: [Object], ssr: true }
],
lastMatchId: '/',
dehydratedData: {
queryStream: ReadableStream { locked: false, state: 'readable', supportsBYOB: false }
}
}
Your Example Website or App
https://vocal-moxie-902b3d.netlify.app/
Steps to Reproduce the Bug or Issue
- Fork the example "basic-ssr-file-based" (https://tanstack.com/router/v1/docs/framework/react/examples/basic-ssr-file-based)
- apply these changes: simllll/tanstack-router-test@bdbee23
Call "http://localhost:3000" via curl or browser, and you will see you never get a response.
Expected behavior
The server should work as before, I don't even use "useQuery" in the example at all, I just added the plugin (renderRouterToString) and it stops working.
Screenshots or Videos
No response
Platform
- Router Version: 1.131.44
- OS: Linux
- Browser: not relevant, but Chrome and "curl"
- Browser Version: curl 8.5.0, chrome Version 136.0.7103.113 (Offizieller Build) (64-Bit)
- Bundler: vite with express middleware
- Bundler Version: vite 6.3.6+ / latest tested version: 7.1.5
Additional context
For me it seems the issue lies in seroval's crossSerializeStream(), I couldn't find a documentation for "onDone", but saw other examples with it.. I'm not sure why, but in my case the onDone is never called.
Other notes:
- maybe we could add a "timeout" promise with a race, to not run into endless promises in this case also for the future?