Skip to content

lit-ui-router-effect / RouterRefControllerOptions

Interface: RouterRefControllerOptions<T> ​

Defined in: lit-ui-router-effect/src/router-ref-controller.ts:12

Options for RouterRefController.

Extends ​

Type Parameters ​

Type Parameter
T

Properties ​

PropertyTypeDescriptionInherited fromDefined in
equals?(a, b) => booleanComparer deciding whether the selected value changed. Defaults to Object.is; pass Equal.equals for structural comparison (plain objects on effect 4, Data values on either major).RefControllerOptions.equalslit-ui-router-effect/src/ref-controller.ts:61
initialValue?TValue exposed on .value before the first read of a ref that is only resolved on hostConnected (see RefSource) — that is, before the host connects, and on any host that renders while disconnected (SSR). Refs given directly are read at construction instead, so they never need it.RefControllerOptions.initialValuelit-ui-router-effect/src/ref-controller.ts:54
onChange?(value) => voidInvoked (before host.requestUpdate()) whenever the selected value changes — and once on every host (re)connect. Use for effects such as resetting component state from route params.RefControllerOptions.onChangelit-ui-router-effect/src/ref-controller.ts:45
router?| UIRouter | (() => | UIRouter | undefined)Explicit router instance, or a thunk returning one. When omitted (or the thunk returns undefined), the controller takes the router an enclosing withRouterSync scoped at construction (a server render), and otherwise requests the router from the nearest enclosing <ui-router> element on hostConnected (via requestRouter with subscribe: true), and follows the router that provider hands it later, such as the app's router replacing a served page's placeholder. An explicit or scoped router is read at construction, so .value is live before the host connects. A thunk is resolved at construction and again on each hostConnected; a router it returns replaces the one followed, as RouterRefController.setRouter does. An explicit router is never replaced by one a provider hands over. A lit-ui-router that does not hand subscribers the router replacing its placeholder leaves a served page's host on the placeholder; hand such a host its router.-lit-ui-router-effect/src/router-ref-controller.ts:31
runtime?RefRuntimeThe runtime the subscription fiber is forked on, and refs are read with. Defaults to Effect's default runtime; pass the app's ManagedRuntime to keep the fibers on one. The selector gets no services from it.RefControllerOptions.runtimelit-ui-router-effect/src/ref-controller.ts:68