Skip to content

Function: getTransitionReachableRoutes()

API / @xmachines/play-router / getTransitionReachableRoutes

function getTransitionReachableRoutes(graph, stateId): string[];

Defined in: query.ts:113

Get routes reachable via transitions from current state

Uses the @statelyai/graph successor algorithm to find all states directly reachable via transition edges from the given state, then filters to those with defined routes.

Parameters

ParameterTypeDescription
graphGraph<MachineNodeData, MachineEdgeData>Machine graph from RouteTree.graph
stateIdstringCurrent state ID (e.g., “test.home”)

Returns

string[]

Array of route paths reachable via transitions

Example

const tree = extractMachineRoutes(machine);
if (tree.graph) {
const reachable = getTransitionReachableRoutes(tree.graph, "auth.loggedIn");
// ['/dashboard', '/settings'] — routes reachable via transitions
}