Function: detectDuplicateRoutes()
API / @xmachines/play-router / detectDuplicateRoutes
function detectDuplicateRoutes(routes): void;Defined in: validate-routes.ts:69
Detect duplicate route paths
THROWS ERROR when multiple states share the same RESOLVED full path.
Detection operates on resolved full paths (after relative routes have been
prefixed with their parent’s path in buildRouteTree), not on raw route
strings: two relative "settings" routes under different parents resolve to
distinct full paths and are valid, while a relative route and an absolute
route resolving to the same URL genuinely collide and must be rejected.
Called from buildRouteTree once full paths are known.
Rationale: URL-based routing requires one-to-one mapping between URLs and states. Multiple states at the same path creates ambiguity for browser navigation (back button, direct URL access). Use different paths for different states, or single state with conditional rendering.
Parameters
| Parameter | Type | Description |
|---|---|---|
routes | ResolvedRoutePath[] | Array of route entries with resolved full paths (e.g. RouteNodes) |
Returns
void
Throws
If duplicate resolved route paths are detected