fix(routing): keep scroll on search-param updates - #483
Conversation
Audit from #386: add resetScroll: false to search-param replace navigations so filter/sort/vote-lock updates no longer scroll the window to top. Covers useUrlState, useTimelineUrlState filter updates, and the admin artists URL state. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017HWv7vC96Coh27Y4xjjeD4
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
🟢 Approval recommended
The changes are narrowly scoped, consistent with existing resetScroll: false usage in the codebase, and preserve intentional scroll-reset behavior on clear-filters actions.
Pull request overview
This PR addresses an app-wide UX issue where search-param-only replace navigations in TanStack Router reset the window scroll position to the top. It updates the relevant URL-state hooks so filter/sort/vote state changes no longer cause unintended scroll jumps, aligning with the fix pattern previously applied for timeline scroll sync.
Changes:
- Add
resetScroll: falseto search-param-onlyreplacenavigations for admin artists filter/sort updates. - Add
resetScroll: falseto the generic sets-page URL-state update helper (used for vote sort-lock / filters). - Add
resetScroll: falseto timeline/list schedule filter updates (day/time/stages/votes/types).
File summaries
| File | Description |
|---|---|
| src/pages/admin/ArtistsManagement/hooks/useAdminArtistsUrlState.ts | Prevents scroll-to-top on admin artists search-param updates by disabling scroll reset. |
| src/hooks/useUrlState.ts | Prevents scroll-to-top on sets page search-param updates while preserving existing “clear filters” scroll behavior. |
| src/hooks/useTimelineUrlState.ts | Prevents scroll-to-top on schedule timeline/list filter chip updates by disabling scroll reset. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Playwright test resultsDetails
|
Supabase fires auth events on every tab refocus (SIGNED_IN / TOKEN_REFRESHED with the same user), and unconditionally calling router.invalidate() re-runs all route loaders, which can swap in the pending fallback and reset scroll to top. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017HWv7vC96Coh27Y4xjjeD4
Adds
resetScroll: falseto search-param-only replace navigations (vote sort-lock, vote/timeline/admin filters) so they no longer scroll the window to top. Closes #386; the invite-flow site from that audit was already refactored into a real page navigation and needs no change.Also guards the global
router.invalidate()so Supabase's refocus auth events (same user) no longer re-run all route loaders — which could swap in the pending fallback and reset scroll on tab refocus.Verification