Skip to content

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

Description

@TylerRick

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions