From 7246debb693583727123d3598d7f81394186632d Mon Sep 17 00:00:00 2001 From: Shirone Date: Sat, 24 Jan 2026 15:44:38 +0100 Subject: [PATCH] feat: Aggregate running auto tasks across all worktrees in BoardView - Introduced a new memoized function to collect running auto tasks from all worktrees associated with the current project. - Updated the WorktreeTab component to utilize the aggregated running tasks for improved task management visibility. - Enhanced spinner visibility by applying a variant based on the selected state, ensuring better UI feedback during loading states. --- apps/ui/src/components/views/board-view.tsx | 12 +++++++++++- .../worktree-panel/components/worktree-tab.tsx | 12 ++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/apps/ui/src/components/views/board-view.tsx b/apps/ui/src/components/views/board-view.tsx index 30df9657..8a53fc6f 100644 --- a/apps/ui/src/components/views/board-view.tsx +++ b/apps/ui/src/components/views/board-view.tsx @@ -463,6 +463,16 @@ export function BoardView() { const selectedWorktreeBranch = currentWorktreeBranch || worktrees.find((w) => w.isMain)?.branch || 'main'; + // Aggregate running auto tasks across all worktrees for this project + const autoModeByWorktree = useAppStore((state) => state.autoModeByWorktree); + const runningAutoTasksAllWorktrees = useMemo(() => { + if (!currentProject?.id) return []; + const prefix = `${currentProject.id}::`; + return Object.entries(autoModeByWorktree) + .filter(([key]) => key.startsWith(prefix)) + .flatMap(([, state]) => state.runningTasks ?? []); + }, [autoModeByWorktree, currentProject?.id]); + // Get in-progress features for keyboard shortcuts (needed before actions hook) // Must be after runningAutoTasks is defined const inProgressFeaturesForShortcuts = useMemo(() => { @@ -1372,7 +1382,7 @@ export function BoardView() { setWorktreeRefreshKey((k) => k + 1); }} onRemovedWorktrees={handleRemovedWorktrees} - runningFeatureIds={runningAutoTasks} + runningFeatureIds={runningAutoTasksAllWorktrees} branchCardCounts={branchCardCounts} features={hookFeatures.map((f) => ({ id: f.id, diff --git a/apps/ui/src/components/views/board-view/worktree-panel/components/worktree-tab.tsx b/apps/ui/src/components/views/board-view/worktree-panel/components/worktree-tab.tsx index 25a79f96..a4722406 100644 --- a/apps/ui/src/components/views/board-view/worktree-panel/components/worktree-tab.tsx +++ b/apps/ui/src/components/views/board-view/worktree-panel/components/worktree-tab.tsx @@ -260,8 +260,10 @@ export function WorktreeTab({ aria-label={worktree.branch} data-testid={`worktree-branch-${worktree.branch}`} > - {isRunning && } - {isActivating && !isRunning && } + {isRunning && } + {isActivating && !isRunning && ( + + )} {worktree.branch} {cardCount !== undefined && cardCount > 0 && ( @@ -327,8 +329,10 @@ export function WorktreeTab({ : 'Click to switch to this branch' } > - {isRunning && } - {isActivating && !isRunning && } + {isRunning && } + {isActivating && !isRunning && ( + + )} {worktree.branch} {cardCount !== undefined && cardCount > 0 && (