Ensure requests are cancelled properly in useFetch()
(#19568)
This commit is contained in:
parent
7a5b6efe7f
commit
58c4fa4139
1 changed files with 3 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue