HighX
Client

SSR and hydration

Seeding the browser's cache so a rendered page never flashes.

The React binding can seed a query result that was read by a server adapter, so a server-rendered page arrives with data already in it. HighX does not prescribe a route framework or expose a universal ctx.read() object; the server adapter must call createServerReader() with the authenticated query executor.

On the server

createServerReader() produces the arguments, value, and sequence needed for a hydration entry:

const read = createServerReader(async (path, args) => {
  // Execute the query through the tenant authority and return its cursor.
  return await executeQuery(path, args);
});
const initial = await read("notes.list", {});
// { args, value, sequence }

Serialize it into the page however your framework does that.

In the browser

const notes = useQuery(api.notes.list, initial.args, {
  initialData: initial.value,
  sequence: initial.sequence,
});

Seeding happens before subscribing, so the cache is warm at a known sequence and the subscription picks up from there. isLoading is false on the first render.

Pass the sequence along with the data. Seeded data without one means the client cannot tell what it has already seen, and the first patch arrives against an unknown baseline.

Public pages

A page that is not behind a session reads from global storage instead, and says what it is:

cache-control: public, max-age=60
x-highx-consistency: eventual

That payload carries no subscription ID and no sequence, so a public reader cannot mistake it for a live view.

Server rendering has no connection

During SSR there is no transport, so useConnectionStatus() returns undefined and hooks read only what was seeded. Draw undefined as "unknown", never as "offline".

On this page