Skip to content

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

Description

@KyleAMathews

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions