Skip to content

Class: SolidRouterBridge

API / @xmachines/play-solid-router / SolidRouterBridge

Defined in: packages/play-solid-router/src/solid-router-bridge.ts:54

SolidJS Router integration bridge extending RouterBridgeBase

Implements RouterBridge protocol for SolidJS Router using Solid’s reactive primitives. The actor→router direction uses TC39 Signal watcher (from base class). The router→actor direction uses Solid’s createEffect for native reactivity.

Path parameters are extracted from Solid’s useParams() reactive proxy rather than re-parsing the URL with URLPattern. This means parameterized routes work without the URLPattern polyfill — Solid’s router has already extracted the values.

Extends

Constructors

Constructor

new SolidRouterBridge(
solidNavigate,
location,
params,
actor,
routeMap): SolidRouterBridge;

Defined in: packages/play-solid-router/src/solid-router-bridge.ts:75

Create a SolidJS Router bridge

CRITICAL: connect() must be called inside a Solid component where hooks are available.

Parameters

ParameterTypeDescription
solidNavigateNavigatorResult of useNavigate() hook
locationLocationLikeResult of useLocation() hook
paramsParamsResult of useParams() hook — used directly for path parameter extraction, avoiding the URLPattern polyfill requirement for parameterized routes
actorRoutableActorXMachines actor instance
routeMapRouteMapBidirectional state ID ↔ path mapping

Returns

SolidRouterBridge

Overrides

RouterBridgeBase.constructor

Methods

connect()

connect(): void;

Defined in: packages/play-router/src/router-bridge-base.ts:151

Connect the router bridge to the Actor.

Sets up the TC39 Signal watcher for actor → router direction and starts watching router changes (framework-specific).

Ordering here is part of the bridge contract:

  • lastSyncedPath is seeded in the constructor from actor.currentRoute
  • the actor watcher is installed before adapter router subscriptions
  • initial sync then resolves deep-link vs restore using actor.initialRoute

Adapters that need custom initial-sync behavior should override getInitialRouterPath() rather than reordering connect() steps.

Returns

void

Inherited from

RouterBridgeBase.connect


disconnect()

disconnect(): void;

Defined in: packages/play-router/src/router-bridge-base.ts:256

Disconnect the router bridge from the Actor.

Stops signal watching and unregisters framework-specific router listener.

Returns

void

Inherited from

RouterBridgeBase.disconnect


dispose()

dispose(): void;

Defined in: packages/play-solid-router/src/solid-router-bridge.ts:187

Dispose the bridge (alias for disconnect).

Returns

void

Example

onCleanup(() => bridge.dispose());