Skip to content
Source
Sign inSign up
TanStack/db

SSR and hydration support for @tanstack/angular-db #1965

Send to my agent
OpenKyleAMathews(GitHub profile, opens in a new tab) opened this issue 0 comments

Follow-up to #1623 (Phase 6). #1564 added core DbClient, collection descriptors, and dehydration/hydration, while Angular still needs its own client/SSR integration.

Goal

Make injectLiveQuery work during Angular server rendering with a request-scoped DbClient, and hydrate the result into the browser client before components first read it. Keep Angular DI and signals as the public integration model.

Acceptance criteria

  • Provide an Angular DI provider/token (or equivalent idiomatic API) for DbClient. A server request gets a fresh client; the browser keeps a stable client. Existing direct-collection queries continue to work.
  • injectLiveQuery can resolve collection descriptors through that client and render preloaded collection or live-query results on the server. dbClient.dehydrate() supplies the state to transfer.
  • Transfer and hydrate the state before the first browser query read (using Angular TransferState or an equivalent mechanism). Initial rows and order match server HTML; normal sync then takes over without duplicates or hydration errors.
  • Add an integration or E2E test through a real Angular SSR/hydration path. Cover independent requests and a live update after hydration.
  • Document the DI/server setup and any unsupported query forms.

Reuse the core SSR payload and observer contract; avoid a separate Angular-only state format.

Sign in to join this conversation.