792 B
792 B
ADR 0003 — URL hash persistence for pagination (page & per)
Date: 2025-09-02
Context
Users want to preserve pagination state across refresh and sharable URLs without adding a router or build step.
Decision
- Introduce
src/state/hash.jswithparseHash/getState/setState/setPage/setPerand an eventqedit:hash:updated. - Add
scripts/init-hash.mjsto bind the items-per-page dropdown and mirror state to localStorage via the prefs module. - Keep the app static and incremental; no changes to
script.jsare required.
Consequences
- Add a single ESM script tag to
index.html:<script type="module" src="./scripts/init-hash.mjs"></script> - Other parts of the app can listen to
qedit:hash:updatedor callsetPage/setPerdirectly if needed.