Class: TanStackRouterBridgeBase
API / @xmachines/play-tanstack-router / TanStackRouterBridgeBase
Defined in: play-tanstack-router/src/tanstack-router-bridge-base.ts:102
Shared TanStack Router adapter implementing RouterBridge protocol via RouterBridgeBase
Remarks
Extends RouterBridgeBase to handle all common lifecycle and sync logic; adds the TanStack-specific navigation and subscription methods shared by the React and Solid adapters.
Subscribes to router.history (not router.subscribe(“onBeforeLoad”)) so that
back/forward browser navigation (popstate events) are also captured. The
router.subscribe(“onBeforeLoad”) approach only works when TanStack’s
Transitioner component is mounted (i.e. inside a full router.history.subscribe(router.load).
Architectural Invariants:
- INV-02 (Passive Infrastructure): Router reflects actor state, never decides
- Actor validates all navigation via guards before URL changes
The class is concrete — it can be instantiated directly. The framework
packages re-export or subclass it purely to bind the public adapter name
(and, for Solid, to add the dispose() alias).
Example
const bridge = new TanStackRouterBridgeBase(router, actor, routeMap);bridge.connect();return () => bridge.disconnect();Extends
Extended by
Constructors
Constructor
new TanStackRouterBridgeBase( router, actor, routeMap): TanStackRouterBridgeBase;Defined in: play-tanstack-router/src/tanstack-router-bridge-base.ts:112
Create a TanStack Router bridge
Parameters
| Parameter | Type | Description |
|---|---|---|
router | TanStackRouterLike | TanStack Router instance (from createRouter) |
actor | RoutableActor | XMachines actor instance |
routeMap | TanStackRouteMapLike | Bidirectional mapping between state IDs and paths |
Returns
TanStackRouterBridgeBase
Overrides
Methods
connect()
connect(): void;Defined in: play-router/dist/router-bridge-base.d.ts:120
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:
lastSyncedPathis seeded in the constructor fromactor.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
disconnect()
disconnect(): void;Defined in: play-router/dist/router-bridge-base.d.ts:126
Disconnect the router bridge from the Actor.
Stops signal watching and unregisters framework-specific router listener.
Returns
void