fix(dashboard): handle null responses in widget data fetching

This commit is contained in:
Kalana B. Thilakarathna
2026-08-29 20:36:01 +05:30
parent 29f181d5e1
commit cd5acbab76
6 changed files with 10 additions and 10 deletions
@@ -16,7 +16,7 @@ export function StockAlertsWidget() {
setLoading(true)
try {
const res = await stock.balances({ pageSize: 100, page: 1 })
const low = res.items.filter(b => b.quantity <= LOW_STOCK_THRESHOLD)
const low = (res.items ?? []).filter(b => b.quantity <= LOW_STOCK_THRESHOLD)
setAlerts(low)
} catch {
// silent