From c645d66c697337cad21dd20fbac795d73813d255 Mon Sep 17 00:00:00 2001 From: xxnmeet Date: Tue, 19 Nov 2024 12:10:47 +0800 Subject: [PATCH] fix: initial loading unable to update correctly --- src/useAsyncFn.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/useAsyncFn.ts b/src/useAsyncFn.ts index d330ffbadc..052b99dc4a 100644 --- a/src/useAsyncFn.ts +++ b/src/useAsyncFn.ts @@ -45,9 +45,7 @@ export default function useAsyncFn( const callback = useCallback((...args: Parameters): ReturnType => { const callId = ++lastCallId.current; - if (!state.loading) { - set((prevState) => ({ ...prevState, loading: true })); - } + set((prevState) => ({ ...prevState, loading: true })); return fn(...args).then( (value) => {