Solid Start 2.0.0-rc.0: custom serialization adapters emitted into Solid’s SSR stream run before hydrate() installs the adapter map — uncaught `$_TSR.t is undefined` #8104
Which project does this relate to?#
Start
Describe the bug#
With a custom serialization adapter registered in start.ts and a route whose loader primes a query through @tanstack/solid-router-ssr-query, every page load throws:
TypeError: Cannot read properties of undefined (reading 'get')
The dehydrated query state reaches Solid's own SSR resource stream, not just the router's pipeline, so the adapter expression is emitted twice:
- inside Solid's stream script (
_$HY.r["0"] = …) as a bare$_TSR.t.get("Money")(1234)— no$_TSR.p(...)wrapper, and ahead of the router's$tsr-stream-barrierscript that definesself.$_TSR. Solid's stream scripts run at parse time, so this one throws (or reports$_TSR is not definedwhen it parses before the router's bootstrap); - inside the router's barrier script, correctly wrapped in
$_TSR.p(...)and buffered untilhydrate()installs the adapter map.
A loader that simply returns the adapter-typed value does NOT reproduce it — that path is serialized by the router's pipeline alone. It takes the ssr-query dehydration path, which is the ordinary shape for an app reading session or loader data through the query cache.
Complete minimal reproducer#
https://github.com/TylerRick/tanstack-solid-ssr-query-adapter-repro
Steps to Reproduce the Bug or Issue#
pnpm installpnpm dev- Open http://localhost:5597 with the console visible — one uncaught
TypeErrorper load. - Optional confirmation in the served HTML: the same
$_TSR.t.get("Money")(…)expression appears once unbuffered inside_$HY.r[...], and once inside$_TSR.p(...)in the barrier script.
Expected behavior#
Adapter expressions emitted into Solid's SSR stream are buffered the way the router's own chunks are — or the adapter map is installed before any stream script can run — so a page that streams adapter-typed data through ssr-query loads without an uncaught error.
Screenshots or Videos#
No response
Platform#
- Router / Start Version:
@tanstack/solid-start,@tanstack/solid-router,@tanstack/solid-router-ssr-query2.0.0-rc.0;@tanstack/solid-query6.0.0-rc.0;@tanstack/router-core1.171.16 - solid-js /
@solidjs/web: 2.0.0-rc.0 - OS: Linux
- Browser: Chromium 141
- Bundler: vite 8.2.1 (vite-plugin-solid 3.0.0-next.27)
Additional context#
Ours carries a Temporal.PlainDate on the session, so every page load for a user with that field set threw. Workaround we ship: an inline head script, rendered first, that installs $_TSR as an accessor with a passthrough t map, so nothing throws whichever script parses first and hydrate()'s real map still wins.
Related: #5737 (closed, different cause), #7706 (adapter deserialization broken by calling a server fn from the client entry).
please provide an actual reproducer project as a git repo. this is required. also don't paste your AI output here. write a concise description instead. future issues not following this will be closed
schiller-manuel(GitHub profile, opens in a new tab) added labelsinformation needed
Added a reproducer repo and shortened the description, per the note on #8107: https://github.com/TylerRick/tanstack-solid-ssr-query-adapter-repro
Fnine59(GitHub profile, opens in a new tab) linked this to #8105
Sign in to join this conversation.
Fixed by #8105. Solid SSR hydration payloads that use custom serialization adapters now wait for the router adapter map, including when they arrive before the router bootstrap.