From 0bf6043fad11d2ccc5f863adc063af51419d9e1e Mon Sep 17 00:00:00 2001 From: Vadym Samoilenko Date: Mon, 30 Mar 2026 16:06:22 +0100 Subject: [PATCH] Fix: task result not stored in useTaskPolling, causing false 'no personas' error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a task completed, the result payload (personas_created, errors_count, etc.) was discarded instead of being saved to state. AIRecruiter always read generationState.result as undefined → count = 0 → showed error even when the backend had successfully created all personas. Co-Authored-By: Claude Sonnet 4.6 --- src/hooks/useTaskPolling.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hooks/useTaskPolling.ts b/src/hooks/useTaskPolling.ts index 91e9b694..4af45eb2 100644 --- a/src/hooks/useTaskPolling.ts +++ b/src/hooks/useTaskPolling.ts @@ -14,6 +14,7 @@ interface TaskPollingState { isComplete: boolean; taskId: string | null; error: string | null; + result: Record | null; } interface TaskPollingControls { @@ -32,6 +33,7 @@ const initialState: TaskPollingState = { isComplete: false, taskId: null, error: null, + result: null, }; export function useTaskPolling( @@ -56,7 +58,7 @@ export function useTaskPolling( if (cancelled) return; if (result.status === 'completed') { - setState(prev => ({ ...prev, isGenerating: false, isComplete: true, hasError: false, error: null })); + setState(prev => ({ ...prev, isGenerating: false, isComplete: true, hasError: false, error: null, result: result.result || null })); } else if (result.status === 'failed') { setState(prev => ({ ...prev,