diff --git a/apps/app/src/components/ui/branch-autocomplete.tsx b/apps/app/src/components/ui/branch-autocomplete.tsx index 1dbd32f0..7b2b5bd5 100644 --- a/apps/app/src/components/ui/branch-autocomplete.tsx +++ b/apps/app/src/components/ui/branch-autocomplete.tsx @@ -33,8 +33,8 @@ export function BranchAutocomplete({ return Array.from(branchSet).map((branch) => { const cardCount = branchCardCounts?.[branch]; // Show card count if available, otherwise show "default" for main branch only - const badge = cardCount !== undefined - ? String(cardCount) + const badge = branchCardCounts !== undefined + ? String(cardCount ?? 0) : branch === "main" ? "default" : undefined; diff --git a/apps/app/src/components/views/board-view.tsx b/apps/app/src/components/views/board-view.tsx index 9cc23636..b1b64247 100644 --- a/apps/app/src/components/views/board-view.tsx +++ b/apps/app/src/components/views/board-view.tsx @@ -272,17 +272,13 @@ export function BoardView() { // Calculate unarchived card counts per branch const branchCardCounts = useMemo(() => { - const counts: Record = {}; - - // Count unarchived features (status !== "completed") per branch - hookFeatures.forEach((feature) => { + return hookFeatures.reduce((counts, feature) => { if (feature.status !== "completed") { - const branch = feature.branchName || "main"; + const branch = feature.branchName ?? "main"; counts[branch] = (counts[branch] || 0) + 1; } - }); - - return counts; + return counts; + }, {} as Record); }, [hookFeatures]); // Custom collision detection that prioritizes columns over cards