Interface: PlayRouteEvent
Documentation / @xmachines/play-react-router / PlayRouteEvent
Defined in: play-router/dist/types.d.ts:182
Enhanced routing event with parameter and query support
Unified routing event used throughout the Play architecture. Supports parameter-aware
navigation patterns (e.g., /profile/:userId) for dynamic route segments.
Architectural Context: Implements Passive Infrastructure (INV-04) by representing
user navigation intent that the Actor evaluates through guards. Infrastructure proposes
via play.route events, Actor decides via state machine transitions.
Browser Navigation Flow:
- Browser fires
popstate - Router adapter resolves URL to route target
- Adapter sends
PlayRouteEventto Actor - Actor validates transition via state machine guards
Param
Event discriminator (always “play.route”)
Param
Target state ID with # prefix (e.g., ‘#home’, ‘#profile’)
Param
Merged path + query parameters (path parameters win conflicts)
Param
Query parameters only (isolated from path params)
Param
Full URLPattern match result for debugging/observability (optional)
Examples
Combining base and routing events
import type { PlayEvent } from "@xmachines/play";import type { PlayRouteEvent } from "@xmachines/play-router";
type AppEvent = PlayEvent | PlayRouteEvent;Basic navigation to a route
import type { PlayRouteEvent } from "@xmachines/play-router";
const event: PlayRouteEvent = { type: "play.route", to: "#home",};actor.send(event);Navigation with route parameters
import type { PlayRouteEvent } from "@xmachines/play-router";
const event: PlayRouteEvent = { type: "play.route", to: "#profile", params: { userId: "123" },};actor.send(event);// Resolves to route: /profile/123Navigation with query parameters
import type { PlayRouteEvent } from "@xmachines/play-router";
const event: PlayRouteEvent = { type: "play.route", to: "#settings", params: { section: "profile" }, // Merged: path + query query: { tab: "security" }, // Query-only};actor.send(event);// Resolves to route: /settings/profile?tab=securitySee
Remarks
Use play.route when you need parameter-aware navigation with the route: {}
config pattern on your state machine nodes. The match field exposes the full
URLPatternResult for advanced use cases (debugging, pattern analysis).
Indexable
[key: string]: unknown