From 43d9116c51889d722bcbd7d03fc6848c8aa6cbba Mon Sep 17 00:00:00 2001 From: root Date: Fri, 3 Jul 2026 15:04:05 +0000 Subject: [PATCH] fix: restore localStorage filter persistence in LogisticsReadinessBoard, SW v60 --- public/service-worker.js | 4 ++-- src/components/logistics/LogisticsReadinessBoard.jsx | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/public/service-worker.js b/public/service-worker.js index 79e4fb7..b900d40 100644 --- a/public/service-worker.js +++ b/public/service-worker.js @@ -1,8 +1,8 @@ const isLocalhost = self.location.hostname === "localhost" || self.location.hostname === "127.0.0.1"; if (!isLocalhost) { - const STATIC_CACHE = "construction-delivery-static-v59"; - const RUNTIME_CACHE = "construction-delivery-runtime-v59"; + const STATIC_CACHE = "construction-delivery-static-v60"; + const RUNTIME_CACHE = "construction-delivery-runtime-v60"; const APP_SHELL_URLS = ["/", "/index.html", "/manifest.webmanifest", "/icons/icon-192.png", "/icons/icon-512.png"]; self.addEventListener("install", (event) => { diff --git a/src/components/logistics/LogisticsReadinessBoard.jsx b/src/components/logistics/LogisticsReadinessBoard.jsx index eb5e035..7bbedc2 100644 --- a/src/components/logistics/LogisticsReadinessBoard.jsx +++ b/src/components/logistics/LogisticsReadinessBoard.jsx @@ -245,7 +245,10 @@ const SortableSection = ({ statusValue, label, groups, isCollapsed, onToggle, on }; export const LogisticsReadinessBoard = ({ orderGroups = [], onSelectSet, statusOptions = ORDER_GROUP_DISPLAY_STATUS_OPTIONS, isLoading = false }) => { - const [filters, setFilters] = React.useState({ query: "", displayStatus: "all", city: "" }); + const FILTERS_KEY = "logistics-filters"; + const savedFilters = (() => { try { return JSON.parse(localStorage.getItem(FILTERS_KEY) || "null"); } catch { return null; } })(); + const [filters, setFilters] = React.useState(savedFilters || { query: "", displayStatus: "all", city: "" }); + React.useEffect(() => { try { localStorage.setItem(FILTERS_KEY, JSON.stringify(filters)); } catch {} }, [filters]); const [collapsedSections, setCollapsedSections] = React.useState(() => loadCollapsedSections()); const [sectionOrder, setSectionOrder] = React.useState(() => { const custom = loadCustomOrder();