Fix: task result not stored in useTaskPolling, causing false 'no personas' error
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 <noreply@anthropic.com>
This commit is contained in:
parent
2e85fc1acc
commit
0bf6043fad
1 changed files with 3 additions and 1 deletions
|
|
@ -14,6 +14,7 @@ interface TaskPollingState {
|
|||
isComplete: boolean;
|
||||
taskId: string | null;
|
||||
error: string | null;
|
||||
result: Record<string, any> | 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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue