Zhou
Zhou MingxuanHead of R&D
Quality gate blocked
  • Coverage is 55% below 60%

Fix the cart badge quantity

hanshop-mobilefix/cart-badgeLin Xi · 2026-06-05 15:02
src/cart/badge.ts+21
11 export function badgeCount(items: CartItem[]) {
2- return items.length;
2+ // Sum quantities, not line items
3+ return items.reduce((sum, item) => sum + item.qty, 0);
A
AI reviewerAIMinor
The reduce initializer is correct, but item.qty may be undefined in imported data. Use item.qty ?? 0 to keep the total numeric.
34 }