Varendo

Adaptive Region lifecycle

Mount once, render typed intent, observe sanitized state, and dispose all work with the host surface.

A Region is the unit of evaluation, presentation, and cleanup. Newer requests replace older ones only inside the same Region.

When you need this

1. Mount the region once

app.mount attaches a region to an element and starts container observation. It fetches nothing until you render.

TypeScript example
const mounted = app.mount({ target, regionId: 'main', resourceId: 'people' });
if (!mounted.ok) throw new Error(mounted.diagnostics[0].message);

Region IDs are unique within the app. A failed mount returns diagnostics instead of an element.

2. Send a request

app.render validates the input, reads current authority, compiles, evaluates, picks a view, commits, and returns the outcome.

TypeScript example
const receipt = await app.render({
  regionId: 'main',
  intent: { version: '1', id: 'browse-people', kind: 'browse', resource: 'people' },
});

receipt.status is one of the values in the table below. A newer request in the same region supersedes an older one still in flight.

3. Watch region state

app.subscribe reports sanitized lifecycle state — phase, result references, and diagnostics — never materialized rows.

TypeScript example
const unsubscribe = app.subscribe('main', (state) => renderStatus(state.phase));

4. Dispose all work

TypeScript example
unsubscribe();
app.unmount('main'); // cancel and release one region
app.dispose(); // release every region, listener, and pending render

Calls after dispose fail closed. Dispose is safe to call more than once.

Read the result status

StatusMeaning
renderer-readyRuntime evidence committed and the renderer accepted the validated presentation — not proof of browser paint or user attention.
needs-inputThe request is valid but needs a user choice or form input.
deniedCurrent trusted authority rejected the operation.
cancelledA newer render, abort signal, unmount, or disposal superseded the request.
unsupportedNo valid registered contract can perform the request.
failedA limited internal or adapter failure occurred; inspect diagnostics and recovery.

What can go wrong