interface / @typed/router/RouteExecutor

RouteExecutor

Transitions between decoded route candidates while retaining compatible mounted work.

Package version
1.0.0-beta.7
Category
Candidate execution
Since
1.0.0

Import

import { RouteExecutor } from "@typed/router/RouteExecutor";

Signatures

export interface RouteExecutor<A, E = never, R = never> {
    readonly transition: (transition: RouteTransition) => Effect.Effect<Fx.Fx<A, E, R | Scope.Scope | Router>, E | RouteDecodeError | RouteGuardError, R>;
}

Why

Parameter-only updates can reuse a handler; route changes switch scopes deterministically.

Ownership and lifetime

An executor is acquired by makeRouteExecutor in a Scope. That Scope owns its current handler and the Layer, layout, and catch managers reused across calls to transition.

Property: transition

Decodes and selects the first accepted candidate for one route transition.

Property: transition: Why

Candidate schemas and guards run in their supplied order after path lookup has selected a matcher shape. Decode failures, guard None, and guard failures fall through; selected identity controls parameter reuse, and route changes switch the owned handler Scope.

Property: transition: Ownership and lifetime

Calls are serialized by the executor’s semaphore. Preparing a replacement occurs before commit; rejection rolls back new Layer Scopes, while commit closes replaced handler and manager Scopes.

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source