SSR request/client boundary
The server entry loads JSON data and calls renderPage. The client entry restores it with hydratePage. Both use a page factory creating the root graph in the current request/client scope.
Restore before model creation and hydration.
Stable SIDs/model names and matching identifierPrefix. JSON state only.
Read this diagram as text
- Server request. Snapshot after rendering includes materialized writable stores. No DOM lifecycle or refs are transferred.
- Client. The manifest preserves identity, not complete dormant collection membership. Build the same graph from load data before adopting matching nodes.
Snapshot after view, restore before model creation. Each request has independent values/collections; the identity manifest repeats generated IDs.
Graph bootstrap remains necessary. Snapshots do not create dormant collections, DOM or callbacks. Non-JSON unit state needs separate data preparation. Test actual node identity during hydration, not only equal HTML.
See SSR API, DOM identity checks and Start.
Complete example sources
tsx
/** @jsxImportSource @virentia/ui */
import App from "./tasks/App";
import { createBoard, type TaskData } from "./tasks/models";
export interface PageData { title: string; tasks: TaskData[] }
export function pageView(data: PageData) {
const board = createBoard(data.tasks, "board", data.title);
return <App model={board} />;
}ts
import { renderDocument, renderPage } from "@virentia/ui/start";
import { pageView, type PageData } from "./ssr-app";
export function renderRequest(data: PageData, clientEntryUrl: string): string {
const page = renderPage(pageView, data, { identifierPrefix: "task-board" });
return renderDocument(page, { title: data.title, clientEntryUrl });
}ts
import { hydratePage } from "@virentia/ui/start";
import { pageView, type PageData } from "./ssr-app";
export function hydrateBoard(container: Element, payloadText: string) {
return hydratePage<PageData>(pageView, container, payloadText);
}:::