Files
resolutionflow/frontend/src/lib/routing.ts
Michael Chihlas 60e52763a7 fix: add type-aware routing for procedural flows
Centralizes tree navigation routing via getTreeNavigatePath helper.
Fixes all pages to route procedural sessions to /flows/:id/navigate
instead of /trees/:id/navigate. Adds safety redirect in troubleshooting
navigator and resume support in procedural navigator.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 22:04:29 -05:00

32 lines
706 B
TypeScript

/**
* Shared routing helpers for tree/session navigation.
* Centralizes the logic for determining the correct navigation path
* based on tree type (troubleshooting vs procedural).
*/
/**
* Get the navigation path for starting or resuming a tree/session.
*/
export function getTreeNavigatePath(
treeId: string,
treeType?: string
): string {
if (treeType === 'procedural') {
return `/flows/${treeId}/navigate`
}
return `/trees/${treeId}/navigate`
}
/**
* Get the editor path for a tree.
*/
export function getTreeEditorPath(
treeId: string,
treeType?: string
): string {
if (treeType === 'procedural') {
return `/flows/${treeId}/edit`
}
return `/trees/${treeId}/edit`
}