Add AbortSignal support to dashboard/blocklist APIs and hooks

This commit is contained in:
2026-04-21 17:29:05 +02:00
parent 51e340fa33
commit cf5a000bf5
7 changed files with 122 additions and 16 deletions

View File

@@ -262,13 +262,15 @@ Issues are grouped by category and ordered roughly by severity. Each entry descr
---
### TASK-014 — Add `AbortSignal` to all API functions missing it
### TASK-014 — Add `AbortSignal` to all API functions missing it (done)
**Where found:**
- `frontend/src/api/dashboard.ts``fetchServerStatus`, `fetchBansByJail`, `fetchBanTrend` have no signal parameter.
- `frontend/src/api/jails.ts``fetchJailBannedIps` (and others) have no signal parameter.
- `frontend/src/api/blocklist.ts``fetchSchedule` (used by the polling hook) has no signal parameter.
**Summary:** Added optional `signal` parameters to dashboard API functions and updated `useServerStatus`, `useBanTrend`, `useJailDistribution`, and `useBlocklistStatus` to pass abort signals from refs. Added tests to verify server status and blocklist schedule polling use `AbortSignal`.
**Goal:** Add `signal?: AbortSignal` as the last parameter to every `get`/`post`/`put`/`del` wrapper call in these modules. The pattern is already established in `api/config.ts` and `api/map.ts` and should be replicated uniformly. After adding the parameters, update the consuming hooks to pass their `abortRef.current.signal`.
**Possible traps:**