refactoring-backend #3
@@ -1,29 +1,3 @@
|
||||
### TASK-BUG-03 — MapPage Pagination Resets on Every Data Refresh
|
||||
|
||||
**Where found**
|
||||
`frontend/src/pages/MapPage.tsx` lines ~350–352:
|
||||
```ts
|
||||
useEffect(() => {
|
||||
setPage(1);
|
||||
}, [range, originFilter, selectedCountry, bans, pageSize]);
|
||||
```
|
||||
`bans` is the array returned by `useMapData`. Every time `useMapData` completes a fetch it produces a new array reference. This causes `setPage(1)` to fire after every single background refresh, not just when the user changes a filter.
|
||||
|
||||
**Goal**
|
||||
Remove `bans` from the dependency array. Page should only reset to 1 when the user changes a *filter* (range, originFilter, selectedCountry, pageSize), not when the underlying data refreshes.
|
||||
|
||||
**Possible traps and issues**
|
||||
- After removing `bans`, if `bans.length` shrinks below the current page offset (e.g. the user is on page 3, data refreshes with fewer results), the pagination will show an empty page. Add a separate effect that clamps `page` to `totalPages` when `totalPages` changes: `if (page > totalPages) setPage(totalPages)`.
|
||||
- `visibleBans` is already derived from `bans` via `useMemo`, so the table stays correct without `bans` in the reset effect.
|
||||
|
||||
**Docs changes needed**
|
||||
None required.
|
||||
|
||||
**Why this is needed**
|
||||
Users browsing the per-country ban table on MapPage are returned to page 1 every time the background auto-refresh fires (typically every 30 seconds), which makes the table unusable for pagination beyond the first page.
|
||||
|
||||
---
|
||||
|
||||
### TASK-BUG-04 — `autoSavePayload` Silently Drops Intentional Zero Values
|
||||
|
||||
**Where found**
|
||||
|
||||
Reference in New Issue
Block a user