fix: sessionStorage→localStorage for filter persistence, SW v59

This commit is contained in:
root 2026-07-03 14:14:00 +00:00
parent 1d288279c0
commit 468c3c4097
2 changed files with 5 additions and 5 deletions

View File

@ -1,8 +1,8 @@
const isLocalhost = self.location.hostname === "localhost" || self.location.hostname === "127.0.0.1"; const isLocalhost = self.location.hostname === "localhost" || self.location.hostname === "127.0.0.1";
if (!isLocalhost) { if (!isLocalhost) {
const STATIC_CACHE = "construction-delivery-static-v58"; const STATIC_CACHE = "construction-delivery-static-v59";
const RUNTIME_CACHE = "construction-delivery-runtime-v58"; const RUNTIME_CACHE = "construction-delivery-runtime-v59";
const APP_SHELL_URLS = ["/", "/index.html", "/manifest.webmanifest", "/icons/icon-192.png", "/icons/icon-512.png"]; const APP_SHELL_URLS = ["/", "/index.html", "/manifest.webmanifest", "/icons/icon-192.png", "/icons/icon-512.png"];
self.addEventListener("install", (event) => { self.addEventListener("install", (event) => {

View File

@ -14,16 +14,16 @@ export const useOrderGroups = () => {
const FILTERS_STORAGE_KEY = "supersam_order_filters"; const FILTERS_STORAGE_KEY = "supersam_order_filters";
const [filters, setFilters] = React.useState(() => { const [filters, setFilters] = React.useState(() => {
try { try {
const saved = sessionStorage.getItem(FILTERS_STORAGE_KEY); const saved = localStorage.getItem(FILTERS_STORAGE_KEY);
if (saved) return JSON.parse(saved); if (saved) return JSON.parse(saved);
} catch (e) {} } catch (e) {}
return { query: "", displayStatus: "all", deliveryType: "" }; return { query: "", displayStatus: "all", deliveryType: "" };
}); });
// Persist filters to sessionStorage on every change // Persist filters to localStorage on every change
React.useEffect(() => { React.useEffect(() => {
try { try {
sessionStorage.setItem(FILTERS_STORAGE_KEY, JSON.stringify(filters)); localStorage.setItem(FILTERS_STORAGE_KEY, JSON.stringify(filters));
} catch (e) {} } catch (e) {}
}, [filters]); }, [filters]);
const [selectedOrderGroupId, setSelectedOrderGroupId] = React.useState(null); const [selectedOrderGroupId, setSelectedOrderGroupId] = React.useState(null);