variable / @typed/navigation/model

NavigationEvent

Describes a destination after it has been committed by the navigation backend.

Package version
1.0.0-beta.13
Category
Navigation event schemas
Since
1.0.0

Import

import { NavigationEvent } from "@typed/navigation/model";

Signatures

export declare const NavigationEvent: Schema.Struct<{
    readonly type: Schema.Union<readonly [
        Schema.Literal<"push">,
        Schema.Literal<"replace">,
        Schema.Literal<"reload">,
        Schema.Literal<"traverse">
    ]>;
    readonly destination: Schema.Struct<{
        readonly id: Schema.String;
        readonly key: Schema.String;
        readonly url: Schema.URLFromString;
        readonly state: Schema.Unknown;
        readonly sameDocument: Schema.Boolean;
    }>;
    readonly info: Schema.Unknown;
}>;
export type NavigationEvent = typeof NavigationEvent.Type;

Why

Post-commit handlers should observe the actual destination, not the earlier proposal, so state synchronization can run only after history and current-entry state agree.

Ownership and lifetime

The schema acquires no resources. The navigation operation owns dispatch; scoped handler registration controls who receives the event.

Examples

import { NavigationEvent } from "@typed/navigation/model"
import * as Schema from "effect/Schema"

const isNavigationEvent = Schema.is(NavigationEvent)

Other public imports

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

Source