Stations: the choice Data / Differential images kept for the browser tab (sessionStorage), so that back on the page the running diff pumping is shown again (it never stopped with the page)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-19 11:27:00 +01:00
1 parent 6b3f46434a
commit 1133a91078
1 file changed
+4 -1
+4 -1
View File
@@ -13,7 +13,10 @@ const shift = (d, n) => (d ? new Date(Date.parse(d) + n * 864e5).toISOString().s
export default function Stations({ selection }) {
const [rows, setRows] = useState([]), [checked, setChecked] = useState([]);
const [range, setRange] = useState({ start: shift(selection.start, -3), end: selection.end });
const [images, setImages] = useState(true), [diff, setDiff] = useState(false), [state, setState] = useState(null);
// the choice data/diff kept for the tab: back on the page, the pumping left is shown again (it never stops with the page)
const [images, setImages] = useState(true), [diff, setDiffState] = useState(() => sessionStorage.getItem("pumpDiff") === "1");
const setDiff = d => { sessionStorage.setItem("pumpDiff", d ? "1" : ""); setDiffState(d); };
const [state, setState] = useState(null);
useEffect(() => { call("/api/tracked").then(l => { if (l) { setRows(l); setChecked(l.map(r => r.serial)); } }); }, []);
useEffect(() => {
setState(null);