22 lines
792 B
Markdown
22 lines
792 B
Markdown
# 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.js` with `parseHash/getState/setState/setPage/setPer` and an event `qedit:hash:updated`.
|
|
- Add `scripts/init-hash.mjs` to 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.js` are required.
|
|
|
|
## Consequences
|
|
|
|
- Add a single ESM script tag to `index.html`:
|
|
```html
|
|
<script type="module" src="./scripts/init-hash.mjs"></script>
|
|
```
|
|
- Other parts of the app can listen to `qedit:hash:updated` or call `setPage/setPer` directly if needed.
|