diff --git a/frontend/src/pages/ProceduralNavigationPage.tsx b/frontend/src/pages/ProceduralNavigationPage.tsx index 0947c890..9184e177 100644 --- a/frontend/src/pages/ProceduralNavigationPage.tsx +++ b/frontend/src/pages/ProceduralNavigationPage.tsx @@ -185,7 +185,7 @@ export function ProceduralNavigationPage() { // Start session immediately — no intake form modal // Variables will be filled inline during execution - await startSession(id, {}) + await startSession(id, {}, treeData) } catch { toast.error('Failed to load flow') navigate('/trees') @@ -194,7 +194,7 @@ export function ProceduralNavigationPage() { } } - const startSession = async (id: string, variables: Record) => { + const startSession = async (id: string, variables: Record, treeData?: Tree) => { try { const newSession = await sessionsApi.create({ tree_id: id, @@ -203,9 +203,9 @@ export function ProceduralNavigationPage() { setSession(newSession) setSessionVariables(variables) - // Initialize step states + // Initialize step states — use passed treeData since `tree` state may not have committed yet const initialStates = new Map() - const allSteps = getStepsFromTree(tree!) + const allSteps = getStepsFromTree(treeData || tree!) for (const step of allSteps) { initialStates.set(step.id, { notes: '', verificationValue: '', completedAt: null }) }