Stop job polling on error (404) to prevent infinite poll loop

When the poll request fails (e.g. job not found 404), clear the activeJob
state and stop the interval instead of endlessly retrying. Also refresh
the KB detail to get the current state.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
michael 2026-02-12 16:08:21 -06:00
parent 42bf5ad003
commit 3aa99144d4

View file

@ -128,6 +128,11 @@ export const KnowledgeBase: React.FC = () => {
}
} catch (err) {
console.error('Failed to poll job:', err);
// Stop polling on error (e.g. 404 job not found)
setActiveJob(null);
if (pollRef.current) clearInterval(pollRef.current);
pollRef.current = null;
loadKbDetail(selectedKb.id);
}
}, 3000);
}