From 55de6c21d23695b4279f2789ea32acba852fa4a4 Mon Sep 17 00:00:00 2001 From: Benjamin Admin Date: Tue, 24 Mar 2026 16:04:53 +0100 Subject: [PATCH] Fix session resume: auto-open most advanced sub-session on parent click When reopening a parent session that has page-split sub-sessions, the UI was showing the parent's pipeline step (always step 1/Orientation) instead of navigating to the sub-sessions. Now automatically opens the most advanced sub-session, matching the behavior of handleOrientationComplete. Co-Authored-By: Claude Opus 4.6 --- admin-lehrer/app/(admin)/ai/ocr-pipeline/page.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/admin-lehrer/app/(admin)/ai/ocr-pipeline/page.tsx b/admin-lehrer/app/(admin)/ai/ocr-pipeline/page.tsx index 285e92a..51e1301 100644 --- a/admin-lehrer/app/(admin)/ai/ocr-pipeline/page.tsx +++ b/admin-lehrer/app/(admin)/ai/ocr-pipeline/page.tsx @@ -73,6 +73,12 @@ export default function OcrPipelinePage() { if (data.sub_sessions && data.sub_sessions.length > 0) { setSubSessions(data.sub_sessions) setParentSessionId(sid) + // Parent has sub-sessions — open the most advanced one automatically + const sorted = [...data.sub_sessions].sort( + (a: SubSession, b: SubSession) => (b.current_step || 0) - (a.current_step || 0), + ) + openSession(sorted[0].id, true) + return } else if (data.parent_session_id) { // This is a sub-session — keep parent info but don't reset sub-session list setParentSessionId(data.parent_session_id)