.remote.ts

Data & remote functions

Server data reaches the shell as props; interactivity talks back through Kit's remote functions. Each primitive below runs inside its own island.

query — seeded from SSR

Awaited outside a pending boundary, so it resolves during SSR. In a production build the result is seeded into the client cache and hydration adopts the on-screen HTML with no re-fetch. (Under vite dev the seed can't cross module isolation, so dev re-fetches — cosmetic, documented.)

Hello, world!

resolved during SSR · stamped 2026-08-05T14:22:29.379Z

command + query.refresh()

The counter reads a server value with query. Bump runs a command to mutate server state, then .refresh() re-reads it — all from inside the island.

command → refresh

reactive .current = …

query.live — SSE stream

A streaming server clock over Server-Sent Events. The reactive .current updates each tick after hydration. This one keeps a connection open on purpose.

query.live · SSE stream

connecting…

latest tick: …

query.batch

Three getSquare() calls fired in the same tick collapse into one request. A shared batchAt across all three results proves a single server run.

query.batch · 3 calls → 1 request

batching…

form() — remote guestbook

A remote form() inside an island: enhanced submit with no reload, per-field validation issues, and pending state — all from Kit's own form runtime. With JavaScript off it posts natively to the remote endpoint and post-redirect-gets back. The store is in-memory, so it resets when the server restarts.

remote form() · guestbook

loading entries…