diff --git a/app/page.tsx b/app/page.tsx index e864aee..70c7cba 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -146,23 +146,15 @@ const loadItems = useCallback(async (showLoading = true) => { setItems(data); setFilteredItems(data); setCached(statusFilter, data); - const allSupplierIds = new Set(); - data.forEach(i => { - if (i.expand?.supplier?.id) allSupplierIds.add(i.expand.supplier.id); - }); - setExpandedSuppliers(allSupplierIds); - const allAreaIds = new Set(); - const clusters = clusterByProximity(data, 2); - clusters.forEach(c => allAreaIds.add(c.id)); - setExpandedAreas(allAreaIds); - // Auto-expand every PO sub-group on first load — drivers want to - // see all of a PO's items at once. Per-PO collapse is opt-in. - const allPoIds = new Set(); - data.forEach(i => { - const po = i.expand?.purchase_order; - allPoIds.add(po?.id || '__no_po__'); - }); - setExpandedPOs(allPoIds); + // Default to ALL groups collapsed. Drivers see a flat list of + // stops (suppliers / area clusters / POs) on first load and tap + // one to drill into its items — matches the "open the app, + // see your day" mental model. The "Show all" toolbar action + // (`expandAll`) is still available for the rare case where a + // driver wants everything expanded at once. + setExpandedSuppliers(new Set()); + setExpandedAreas(new Set()); + setExpandedPOs(new Set()); } catch (err) { console.error('Failed to load collections:', err); setError('Failed to load collections. Pull down to retry.');