Extract generic useListData hook for shared list fetching
This commit is contained in:
@@ -304,7 +304,9 @@ Issues are grouped by category and ordered roughly by severity. Each entry descr
|
||||
|
||||
---
|
||||
|
||||
### TASK-016 — Extract generic `useListData` hook to eliminate duplicated fetch-list pattern
|
||||
### TASK-016 — Extract generic `useListData` hook to eliminate duplicated fetch-list pattern (done)
|
||||
|
||||
**Where fixed:** `frontend/src/hooks/useListData.ts`, `frontend/src/hooks/useActionList.ts`, `frontend/src/hooks/useFilterList.ts`, `frontend/src/hooks/useJailConfigs.ts`, `frontend/src/hooks/useBlocklists.ts`, `frontend/src/api/config.ts`, `frontend/src/api/blocklist.ts`, `frontend/src/hooks/__tests__/useListData.test.ts`
|
||||
|
||||
**Where found:** `frontend/src/hooks/useActionList.ts`, `useFilterList.ts`, `useJailConfigs.ts`, and `useBlocklists.ts` each contain ~40 lines of nearly identical code: `useState` for data/loading/error, a `useRef<AbortController>`, a `refresh` callback with abort-create-set-loading-fetch-set logic, and a `useEffect` that calls `refresh` on mount.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user