From 50ad06f43ac8bc1c2821327040653bc050179bf5 Mon Sep 17 00:00:00 2001 From: Benjamin Admin Date: Mon, 2 Mar 2026 08:05:13 +0100 Subject: [PATCH] fix(ocr-pipeline): always run fresh word detection, skip stale cache Word-lookup is now ~0.03s (vs seconds with per-cell Tesseract), so always re-run detection when entering Step 5 instead of showing potentially stale cached word_result from the session DB. Co-Authored-By: Claude Opus 4.6 --- .../ocr-pipeline/StepWordRecognition.tsx | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/admin-lehrer/components/ocr-pipeline/StepWordRecognition.tsx b/admin-lehrer/components/ocr-pipeline/StepWordRecognition.tsx index 4999b23..0671a6b 100644 --- a/admin-lehrer/components/ocr-pipeline/StepWordRecognition.tsx +++ b/admin-lehrer/components/ocr-pipeline/StepWordRecognition.tsx @@ -72,24 +72,9 @@ export function StepWordRecognition({ sessionId, onNext, goToStep }: StepWordRec useEffect(() => { if (!sessionId) return - - const fetchSession = async () => { - try { - const res = await fetch(`${KLAUSUR_API}/api/v1/ocr-pipeline/sessions/${sessionId}`) - if (res.ok) { - const info = await res.json() - if (info.word_result) { - applyGridResult(info.word_result) - return - } - } - } catch (e) { - console.error('Failed to fetch session info:', e) - } - runAutoDetection() - } - - fetchSession() + // Always run fresh detection — word-lookup is fast (~0.03s) + // and avoids stale cached results from previous pipeline versions. + runAutoDetection() // eslint-disable-next-line react-hooks/exhaustive-deps }, [sessionId])