fix: persist normalized fishing plans
This commit is contained in:
@@ -29,7 +29,13 @@ import Layout from "../layouts/Layout.astro";
|
||||
}).slice(0, 5);
|
||||
};
|
||||
const readPlan = (): Array<Record<string, string>> => {
|
||||
try { return normalisePlan(JSON.parse(localStorage.getItem(planStorageKey) || "[]")); }
|
||||
try {
|
||||
const raw = localStorage.getItem(planStorageKey) || "[]";
|
||||
const normalised = normalisePlan(JSON.parse(raw));
|
||||
const serialised = JSON.stringify(normalised);
|
||||
if (serialised !== raw) localStorage.setItem(planStorageKey, serialised);
|
||||
return normalised;
|
||||
}
|
||||
catch { return []; }
|
||||
};
|
||||
const shared = new URLSearchParams(location.search).get("plan");
|
||||
|
||||
Reference in New Issue
Block a user