diff --git a/src/components/orders/OrderFilters.jsx b/src/components/orders/OrderFilters.jsx index bd5c893..ed596a9 100644 --- a/src/components/orders/OrderFilters.jsx +++ b/src/components/orders/OrderFilters.jsx @@ -47,7 +47,7 @@ const DropdownSelect = ({ value, options, onChange, placeholder }) => { {isOpen ? (
{options.map((option) => { const isSelected = option.value === value; @@ -206,7 +206,7 @@ export const OrderFilters = ({ filters, setFilters, statusOptions = [], cities =
{/* Row 2: Date range + SMS problems (width matches its text) + hide-completed toggle */} -
+
updateFilter("dateFrom", v)} diff --git a/src/hooks/useOrderGroups.js b/src/hooks/useOrderGroups.js index 8a0d76d..657cfb3 100644 --- a/src/hooks/useOrderGroups.js +++ b/src/hooks/useOrderGroups.js @@ -92,13 +92,22 @@ export const useOrderGroups = ({ }, [enabled, details, groupId, hideCompleted]); // Initial load + const hasLoadedRef = React.useRef(false); React.useEffect(() => { let cancelled = false; const doLoad = async () => { - const hasCache = !!readOrderGroupsCache(details, hideCompleted); - // If we seeded from cache, don't flash the spinner — refresh silently in bg. - setIsLoading(!hasCache); - await loadLiveData(!hasCache, { forceRefresh: true }); + const isFirst = !hasLoadedRef.current; + if (isFirst) { + const hasCache = !!readOrderGroupsCache(details, hideCompleted); + // Full skeleton only on the very first entry; otherwise refresh silently + // so toggling the "hide completed" switch updates the list in place + // without flashing the whole page / jumping to top. + setIsLoading(!hasCache); + await loadLiveData(!hasCache, { forceRefresh: true }); + hasLoadedRef.current = true; + } else { + await loadLiveData(false, { forceRefresh: true }); + } if (cancelled) return; }; if (enabled) doLoad(); else { setOrderGroups([]); setIsLoading(false); }