Skip to content

Commit 1d42e23

Browse files
author
Alex Cory
committed
abort bugfix
1 parent ef926df commit 1d42e23

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/useFetch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function useFetch<TData = any>(...args: UseFetchArgs): UseFetch<TData> {
3636
perPage,
3737
cachePolicy, // 'cache-first' by default
3838
cacheLife,
39-
suspense,
39+
suspense
4040
} = customOptions
4141

4242
const cache = useCache({ persist, cacheLife, cachePolicy })
@@ -196,7 +196,7 @@ function useFetch<TData = any>(...args: UseFetchArgs): UseFetch<TData> {
196196

197197
// Cancel any running request when unmounting to avoid updating state after component has unmounted
198198
// This can happen if a request's promise resolves after component unmounts
199-
useEffect(request.abort, [])
199+
useEffect(() => request.abort, [])
200200

201201
if (suspense && suspender.current) {
202202
if (isServer) throw new Error('Suspense on server side is not yet supported! 🙅‍♂️')

0 commit comments

Comments
 (0)