fix(hooks): Forward abort signal to fetchBansByCountry in useDashboardCountryData
The useDashboardCountryData hook was creating an AbortController and checking signal.aborted in callbacks, but was not passing the signal to the fetchBansByCountry API call. This meant the HTTP request itself was never actually aborted. Now the signal is forwarded, allowing proper request cancellation when the hook unmounts or dependencies change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -68,7 +68,7 @@ export function useDashboardCountryData(
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
|
||||
fetchBansByCountry(timeRange, origin, source)
|
||||
fetchBansByCountry(timeRange, origin, source, undefined, controller.signal)
|
||||
.then((data) => {
|
||||
if (controller.signal.aborted) return;
|
||||
setCountries(data.countries);
|
||||
|
||||
Reference in New Issue
Block a user