---ISSUE---
Problem
All state updates in useOutagesTableState (src/hooks/useOutagesTableState.ts) call router.push without options:
router.push(`?${next.toString()}`);
Next's router.push scrolls to the top of the page by default. Consequences:
- Scrolling a long incident list is impossible while filtering: an operator on row 40 of the table who opens the severity filter and picks "critical" is yanked to the top; paging to page 3 and then page 2 does the same.
- The scroll reset compounds the keystroke debounce issue (companion issue): typing a search also resets scroll, so the operator loses their place on every character.
- The pattern is inconsistent:
PaymentsView's drawer uses router.replace(..., { scroll: false }) deliberately, proving the codebase knows the option — the table state simply does not use it.
Root cause
The URL-state helpers were written before the scroll behavior was considered, and scroll: false was never added.
Why this is architecturally hard
- The fix is
router.push(\?${next}`, { scroll: false })insetParam/setMultiParam— but scroll restoration on the *return* direction (Back) also needsuseEffect`-based scroll restoration if the page wants to preserve the previous position, which the URL-only model does not give for free.
- The same helpers exist in the duplicate
Dry.tsx copy (companion issue) — the fix must land in the canonical file and the duplicate deleted, or the two drift again.
- A test asserting no scroll on navigation requires mocking the router and asserting the options argument — the current tests assert the URL, not the options.
Proposed design
Pass { scroll: false } to both router.push calls, add a test asserting the router receives it, and (optionally) restore scroll position on Back via a scrollRestoration effect.
Acceptance criteria
Service
Tests
Out of scope
The keystroke debounce (tracked separately) and scroll restoration on Back.
Getting started
npm test -- useOutagesTableState
Good first files to read: src/hooks/useOutagesTableState.ts.
---ISSUE---
Problem
All state updates in
useOutagesTableState(src/hooks/useOutagesTableState.ts) callrouter.pushwithout options:Next's
router.pushscrolls to the top of the page by default. Consequences:PaymentsView's drawer usesrouter.replace(..., { scroll: false })deliberately, proving the codebase knows the option — the table state simply does not use it.Root cause
The URL-state helpers were written before the scroll behavior was considered, and
scroll: falsewas never added.Why this is architecturally hard
router.push(\?${next}`, { scroll: false })insetParam/setMultiParam— but scroll restoration on the *return* direction (Back) also needsuseEffect`-based scroll restoration if the page wants to preserve the previous position, which the URL-only model does not give for free.Dry.tsxcopy (companion issue) — the fix must land in the canonical file and the duplicate deleted, or the two drift again.Proposed design
Pass
{ scroll: false }to bothrouter.pushcalls, add a test asserting the router receives it, and (optionally) restore scroll position on Back via ascrollRestorationeffect.Acceptance criteria
Service
Tests
router.pushis called withscroll: false.Out of scope
The keystroke debounce (tracked separately) and scroll restoration on Back.
Getting started
npm test -- useOutagesTableStateGood first files to read:
src/hooks/useOutagesTableState.ts.