fix: sessionStorage→localStorage for filter persistence, SW v59
This commit is contained in:
parent
1d288279c0
commit
468c3c4097
|
|
@ -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-v58";
|
||||
const RUNTIME_CACHE = "construction-delivery-runtime-v58";
|
||||
const STATIC_CACHE = "construction-delivery-static-v59";
|
||||
const RUNTIME_CACHE = "construction-delivery-runtime-v59";
|
||||
const APP_SHELL_URLS = ["/", "/index.html", "/manifest.webmanifest", "/icons/icon-192.png", "/icons/icon-512.png"];
|
||||
|
||||
self.addEventListener("install", (event) => {
|
||||
|
|
|
|||
|
|
@ -14,16 +14,16 @@ export const useOrderGroups = () => {
|
|||
const FILTERS_STORAGE_KEY = "supersam_order_filters";
|
||||
const [filters, setFilters] = React.useState(() => {
|
||||
try {
|
||||
const saved = sessionStorage.getItem(FILTERS_STORAGE_KEY);
|
||||
const saved = localStorage.getItem(FILTERS_STORAGE_KEY);
|
||||
if (saved) return JSON.parse(saved);
|
||||
} catch (e) {}
|
||||
return { query: "", displayStatus: "all", deliveryType: "" };
|
||||
});
|
||||
|
||||
// Persist filters to sessionStorage on every change
|
||||
// Persist filters to localStorage on every change
|
||||
React.useEffect(() => {
|
||||
try {
|
||||
sessionStorage.setItem(FILTERS_STORAGE_KEY, JSON.stringify(filters));
|
||||
localStorage.setItem(FILTERS_STORAGE_KEY, JSON.stringify(filters));
|
||||
} catch (e) {}
|
||||
}, [filters]);
|
||||
const [selectedOrderGroupId, setSelectedOrderGroupId] = React.useState(null);
|
||||
|
|
|
|||
Loading…
Reference in New Issue