Ensure requests are cancelled properly in useFetch() (#19568)

This commit is contained in:
Jon Koops 2023-04-06 14:07:08 +02:00 committed by GitHub
parent 7a5b6efe7f
commit 58c4fa4139
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,10 +38,11 @@ export function useFetch<T>(
deps?: DependencyList
) {
const onError = useErrorHandler();
const controller = new AbortController();
const { signal } = controller;
useEffect(() => {
const controller = new AbortController();
const { signal } = controller;
adminClientCall()
.then((result) => {
if (!signal.aborted) {