#132 · Keep a server timeline's view across reloads
- timeline-app
- pull request
Closes #128. Reloading a server timeline used to show the whole timeline again. Now a reload keeps its view for that browser tab: - the left and right bounds (exact rationals); - **Follow latest events** (already kept per tab, now in the same record); - the grouping distance ("Group within"); - a separation by tags or relationships. How it works: - **Where it's kept:** one record per server and timeline, or per comparison of saved server timelines. It lives in the tab's session storage, like Follow latest events did. A reload restores it, while a new tab or a shared link still starts from the whole timeline. - **When it's saved:** the record is written once the view settles (300 ms after the last render), before another timeline opens, and when the page is hidden. - **Reading it back:** stored text is treated as untrusted (`src/view-state.ts`). Anything malformed is dropped, so you get the default view. - **Links:** a moment, duration or search link opens what it names instead of a stored separation. A view link sets the bounds as before. - **Sign-out:** signing out forgets the tab's views, as it does the stored windows. Tests: - `test/view-state.test.mjs` covers validation. - `test/follow-browser.mjs` now zooms, changes the grouping distance, reloads and checks bounds, follow and grouping. It then separates, reloads and checks the separation and bounds, rejoins, reloads, and checks that a second tab starts fresh. Locally, the unit tests (253), typecheck and full browser suite pass.
Sources
Open #132 · Keep a server timeline's view across reloads in the timeline