TanStack / TanStack/router

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`

Open
#8,104 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

information needed
Dominant language
TypeScript
Stars
15.1k
Forks
1.9k
Avg merge
1d 20h
Merged PRs (30d)
143

Description

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-barrier script that defines self.$_TSR. Solid's stream scripts run at parse time, so this one throws (or reports $_TSR is not defined when it parses before the router's bootstrap);
  • inside the router's barrier script, correctly wrapped in $_TSR.p(...) and buffered until hydrate() 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
  1. pnpm install
  2. pnpm dev
  3. Open http://localhost:5597 with the console visible — one uncaught TypeError per load.
  4. 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-query 2.0.0-rc.0; @tanstack/solid-query 6.0.0-rc.0; @tanstack/router-core 1.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).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked minimal reproducer and inspect the served HTML, especially the Solid SSR stream script, the router barrier script, and the hydrate() adapter-map installation. Trace the ssr-query dehydration path first; the fix is complete when adapter-typed data loads without an uncaught error and stream expressions are buffered or the adapter map is available before stream scripts run.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vite
Domain
frontend, full-stack
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.