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>
This commit is contained in:
31
frontend/src/lib/routing.ts
Normal file
31
frontend/src/lib/routing.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* 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`
|
||||
}
|
||||
Reference in New Issue
Block a user