feat: URL state persistence for all filters and tabs

This commit is contained in:
Davide Scaini
2026-03-30 20:28:54 +02:00
parent cb345c02a1
commit 5b07c7670c
2 changed files with 46 additions and 0 deletions
+10
View File
@@ -2,6 +2,16 @@
## [Unreleased] — 2026-03-30
### Navigation
- **URL state persistence** — filter and tab state is now stored in the URL query string so the browser back button always restores the exact view you left
- Activity feed (`/`): `?sport=cycling` — sport filter survives back navigation
- Stats page (`/stats/`): `?sport=cycling` — same
- Athlete page (`/athlete/`): `?tab=records` — active tab survives back navigation
- Records tab (`/athlete/?tab=records`): `?sport=cycling` — sport filter within records also persisted; full URL example: `/athlete/?tab=records&sport=cycling`
- All use `history.replaceState` (not `pushState`) so clicking filters does not pollute the history stack — back always goes to the previous *page*, not the previous filter state
- Default values are omitted from the URL for cleanliness (`sport=all` and the default tab are never written)
### Sport classification
- **Sub-sport detection** — `normalise_sub_sport()` in `sport.py` infers sub_sport from raw sport type strings