When a driver collects or reports a problem on an item, the supplier group they were working through used to collapse — forcing them to re-expand it for every single item in the stop. Root cause was a useCallback dep cycle: - loadItems had items.length in its dep array - handleCollect / handleProblem filter the processed item out of state - items.length decreasing rebuilt loadItems (new identity) - the consuming useEffect([loadItems]) re-fired loadItems - loadItems's setExpandedSuppliers(new Set()) wiped every group Fix: mirror items.length into a useRef so loadItems can read the current count for the loading-skeleton decision without subscribing to it. loadItems now only rebuilds when statusFilter changes (mount, filter chip tap, refresh), so processing an item no longer resets the expansion state. Drivers can work through every item in a stop without re-expanding. Behavior preserved on real refreshes / tab switches / filter changes — those still reset to collapsed, which matches the new 'flat list of stops on open' UX. |
||
|---|---|---|
| .. | ||
| login | ||
| map | ||
| settings | ||
| .DS_Store | ||
| globals.css | ||
| layout.tsx | ||
| page.tsx | ||