mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-13 04:01:43 +00:00
Clicking a column header on /runs?view=list silently did nothing. handleSortClick called updateParam three times in a row; each call cloned a fresh URLSearchParams from the same closure-captured searchParams and invoked setSearchParams independently. React Router's setSearchParams calls don't merge in a single tick, so only the last one's params landed in the URL -- the sort change was overwritten by the trailing page-reset. setPageSize had the same shape and was also quietly losing the size change. Replace the per-key URL mutator with a reducer-shaped updatePreferences((prev) => next) that operates on the typed RunsWorkspacePreferences model. URL and localStorage are derived from the same next object via the existing converters, and each handler makes exactly one call -- so concurrent-update races are structurally impossible. Use setSearchParams((prev) => ...) so the updater reads the latest committed URL params instead of a closure. Add page to RunsWorkspacePreferences so the model describes the full URL view state; strip it before persisting to localStorage since page is ephemeral. Rename persistRunsWorkspaceSearchParams to persistRunsWorkspacePreferences to match what it now consumes. Guard the hydration useEffect with a useRef so it runs only on mount. Add a regression test that clicks a SortHeader and asserts the URL gains sort=status while preserving view=list&archived=1, and that a second click toggles direction=asc. |
||
|---|---|---|
| .. | ||
| fabro-web | ||
| marketing | ||
| remotion | ||