Skip to content

Function: extractMachineRoutes()

API / @xmachines/play-tanstack-react-router / extractMachineRoutes

function extractMachineRoutes(machine): RouteTree;

Defined in: play-router/src/extract-routes.ts:93

Extract complete route tree from state machine graph

Converts the XState machine to a @statelyai/graph Graph via machineToGraph(), then walks graph nodes to extract route metadata, validate route references, and build a hierarchical RouteTree. The graph is attached to the returned RouteTree for downstream transition-aware queries.

Parameters

ParameterTypeDescription
machineAnyStateMachineXState v5 state machine

Returns

RouteTree

Route tree with root, byStateId map, byPath map, and graph