v0 · Developer Preview Frond is under active development. APIs may change between releases.

Eviction and release

Release and eviction both tear down a node’s resources. They differ in what survives.

ReleaseEviction
MethodreleaseResources(reason?)evict(mode?, reason?)
ReturnsPromise<void>Promise<EvictResult>
Graph identityKeptRemoved
Graph edgesKeptRemoved
Ready dataClearedCleared
Next readIdle, can reacquireUnwired, must rewire
Use whenIdentity still valid; you’ll read it againIdentity is gone; drop it and its dependents

Release

Release cleans a node’s resources and returns it to Idle, keeping its place in the graph.

await runtime.client.node(ProfileNode, { userId: "u_42" }).releaseResources();

In order, release:

  1. Stops the active live resource, if one exists.
  2. Runs the driver release hook, if configured.
  3. Runs the node’s disposers.
  4. Closes and drops the current ready node instance.
  5. Transitions the cell to Idle (or a release-failure projection).

Graph identity, the graph record, and edges stay. A released node can be acquired again with ensureReady() without rewiring. Missing release hooks are no-ops; release on a node with no cell is a no-op.

Eviction

Eviction removes a node and its dependents from the graph.

const result = await runtime.client.node(SessionNode, Frond.Args.none).evict();
result.nodeIds;  // ids that were removed
result.failures; // cleanup failures, if any

In order, eviction:

  1. Computes the dependency closure for the requested mode.
  2. Interrupts active actor work for each node in the closure.
  3. Runs cleanup, best-effort.
  4. Removes the actor entries, graph node records, and edges touching evicted nodes.
  5. Emits one eviction event with the evicted ids and cleanup failures.

evict() returns an EvictResult of { nodeIds, failures } — the ids removed and any failures collected during cleanup.

Modes

await handle.evict("selfAndDependents"); // default
await handle.evict("dependents");
ModeEffect
selfAndDependentsEvict the node and its reverse dependency closure. Default.
dependentsEvict the reverse closure, leave the node itself.

The reverse dependency closure is every node that depends on the target, directly or transitively. Eviction orders deeper dependents before the nodes they depend on. See Dependencies.

Tip: On logout, evict the session node. Every user-scoped node that declared a session dependency is automatically removed with it — one call clears the entire user subgraph.

Interruption

Eviction interrupts active work on each evicted node. Interrupted work receives the eviction cancellation reason unless the request supplies a more specific one. Late completion of an interrupted acquire, action, refresh, or args reconciliation does not commit after the graph record is removed.

Cleanup failures

Cleanup is best-effort. A failure stopping a live resource or running a disposer does not abort the rest of the cleanup, and does not by itself keep the node’s identity.

  • Release collects failures from live-resource stop, driver release, release-hook disposers, and normal disposers. releaseResources() still resolves void; the runtime emits the retained cleanup failure through events and diagnostics. The projected released cell retains the first failure in execution order as its primary failure.
  • Eviction returns all cleanup failures in EvictResult.failures.

After the call

Reads projectensureReady()
After releaseIdle (or release failure)Reacquires
After evictionUnwired / missingWires and acquires a new node

Idempotency

Releasing a node with no cell is a no-op. Evicting a missing root is ignored — there is no record to remove. Repeated eviction of an already-removed node does not rerun cleanup.


Next: Result validity — how a result moves from current to stale to expired.