Resource & suspense
Guide: Resources & suspense.
Resource(T)
| Export | Signature |
|---|
createResource | (comptime T, io, owner, ctx_ptr, fetcher) !*Resource(T) |
createLocalResource | same-thread variant |
resourceReady | (comptime T, owner, value) !*Resource(T) — pre-resolved |
| Method | Notes |
|---|
get() ?T | reactive; null while loading |
peek() ResourceState(T) | .loading | .ready(T) | .err(anyerror) |
resolve(io) | await + apply staged result (main thread) |
isLoading() / isReady() / isErr() | predicates |
Suspense
| Export | Signature |
|---|
suspense | (ctx, SuspenseOpts{ .fallback: *Node, .id: ?[]const u8 }, ctx_ptr, comptime render_child) *Node |
transition | alias of suspense |
markSuspended | () void — flips the nearest boundary to its fallback |
Streaming
| Export | Purpose |
|---|
StreamRegistry / StreamSlot | track pending boundaries per response |
withStreamRegistry(...) | scope a registry over a render |
Renderer.streamRender(...) | chunked emission: shell first, resolved boundaries follow |
Action
Action / createAction — client-mutation wrapper around a server function with pending state, the dual of Resource for writes.