@tanstack/solid-router
Version:
Modern and scalable routing for Solid applications
38 lines (37 loc) • 2.12 kB
TypeScript
import type { AnyRouter } from '@tanstack/router-core';
/**
* Match-state transfer over Solid's hydration registry — the bare pairing's
* native SSR channel (no `__TSR_SSR__` script injection, no router-owned
* stream protocol). Entries are content-addressed (`tsr:<matchId>`; match
* ids are deterministic route-id + interpolated params, so both sides
* derive the same key from the same URL), the identical mechanism
* solid-query v6 ships query payloads through (`sq:<queryHash>`).
*
* Server half: while the render's serialization context is live, the
* provider writes each settled match's transferable state. Client half: the
* hydration-claiming boot — matching is synchronous, so the provider primes
* match state from the registry and commits before rendering, without
* running loaders or resolving route chunks up front. Route components
* resolve at the read point under the boundaries the server actually
* rendered (Solid `lazy` semantics), and staleness rules own any
* post-hydration refetching.
*
* Both halves no-op under TanStack Start: `router.serverSsr` marks the
* Start contract (`attachRouterServerSsrUtils` / `dehydrate` / `hydrate`),
* which owns transfer there — and a Start-hydrated router reaches the
* client boot with matches already committed, which skips it.
*/
export declare const MATCH_KEY_PREFIX = "tsr:";
export declare function serializeMatchTransfer(router: AnyRouter): void;
/**
* The hydration-claiming boot. Returns true when every synchronously
* matched route found its registry entry and the matches were committed;
* false falls back to the caller's existing behavior (no entries — a
* non-registry server, `noHydrate`, or a pending match the server skipped).
*
* Reads the raw registry rather than sharedConfig's accessors: entries
* arrive as inline scripts that execute at document parse, so they are
* complete before any client code runs — and the boot must commit BEFORE
* the hydration render (store writes inside it are owned-scope writes).
*/
export declare function primeRouterFromRegistry(router: AnyRouter): boolean;