Commit 83a3a27
committed
fix(repositories): keep deep-linked ?page=N when search hasn't changed
The repositories leaderboard table routes `DebouncedSearchInput`'s
`onDebouncedChange` through `useDataTableParams.setFilter('search', ...)`,
whose `useCallback` closes over `react-router-dom`'s `setSearchParams`.
That ref is recreated on every URL change, so every `setPage(N)` recreates
the callback, which re-fires the wrapper's mount-anchored debounce effect.
The fired commit deletes `?page` via the filter's default
`resetPageOnChange`, snapping the table back to page 1 right after the
click.
Same root cause #1108 fixed for `MinerPRsTable`. Apply the same callsite
gate: keep the latest committed `searchQuery` in a ref and skip
`setFilter('search', ...)` when the wrapper hands back the value we
already hold. Typing a new search still commits normally and resets
`?page` as intended; the mount fire and any re-render driven by an
unrelated URL change no longer touches the page slot.
Verified locally:
- Direct load `/repositories?page=1` retains `?page=1` and renders rows
13-15 of 15.
- "Go to next page" / "Go to last page" advance to `?page=1` and stay.
- Typing into the search input still commits the filter after the
debounce and resets `?page` so the result list starts at page 1.
- `npm run build`, `npm run lint`, `npx prettier --check` all clean.1 parent 4508197 commit 83a3a27
1 file changed
Lines changed: 17 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
2 | 8 | | |
3 | 9 | | |
4 | 10 | | |
| |||
256 | 262 | | |
257 | 263 | | |
258 | 264 | | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
259 | 270 | | |
260 | | - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
261 | 276 | | |
262 | 277 | | |
263 | 278 | | |
| |||
0 commit comments