auto-claude: subtask-1-1 - Add useTaskStore import and update task state after successful PR creation (#1683)

- Added useTaskStore import from stores/task-store
- Added task state update logic in handleCreatePRs after successful PR creation
- Tasks now transition from human_review to done status when PR is created
- Task metadata is updated with prUrl from successful PR result
- Only updates tasks that had successful PR creation (not skipped, error, or alreadyExists)
- Follows exact pattern from TaskDetailModal.tsx for consistency

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Andy
2026-02-04 14:07:13 +01:00
committed by GitHub
parent b4e6b2fe43
commit 4587162e43
@@ -24,6 +24,7 @@ import { Checkbox } from './ui/checkbox';
import { Progress } from './ui/progress';
import { ScrollArea } from './ui/scroll-area';
import type { Task, WorktreeCreatePRResult } from '../../shared/types';
import { useTaskStore } from '../stores/task-store';
/**
* Check if an error message indicates a worktree-related issue (missing worktree, no branch, etc.)
@@ -154,6 +155,15 @@ export function BulkPRDialog({
error: data.success ? undefined : (data.error || t('taskReview:pr.errors.unknown'))
} : r
));
// Update task state in store with new status and prUrl (more efficient than reloading all tasks)
if (data.success && data.prUrl && !data.alreadyExists) {
const currentTask = tasks[i];
useTaskStore.getState().updateTask(currentTask.id, {
status: 'done',
metadata: { ...currentTask.metadata, prUrl: data.prUrl }
});
}
} else {
const errorMsg = prResult?.error || '';
setTaskResults(prev => prev.map((r, idx) =>