mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-02 08:33:36 +00:00
fix: address PR review comments
- Fix branch fallback logic: use nullish coalescing (??) instead of || to handle empty strings correctly (empty string represents unassigned features, not main branch) - Refactor branchCardCounts calculation: use reduce instead of forEach for better conciseness and readability - Fix badge semantics in BranchAutocomplete: check branchCardCounts !== undefined first to ensure numeric badges (including 0) only appear when actual count data exists, while 'default' is reserved for when count data is unavailable
This commit is contained in:
@@ -272,17 +272,13 @@ export function BoardView() {
|
||||
|
||||
// Calculate unarchived card counts per branch
|
||||
const branchCardCounts = useMemo(() => {
|
||||
const counts: Record<string, number> = {};
|
||||
|
||||
// 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<string, number>);
|
||||
}, [hookFeatures]);
|
||||
|
||||
// Custom collision detection that prioritizes columns over cards
|
||||
|
||||
Reference in New Issue
Block a user