Skip to content

Commit

Permalink
fix: hooks dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo1v committed Mar 15, 2021
1 parent 67a34c8 commit 514df97
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions reactools/src/hooks/useAsync/useAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function useAsync<T = any>(

resolve(callbackCalled);
}),
[],
[context],
);

const handleCallback = useCallback(async (): Promise<void> => {
Expand Down Expand Up @@ -91,10 +91,13 @@ export function useAsync<T = any>(
payload: { error },
});
}
}, []);
}, [cancel, executePromise]);

useEffect(() => {
handleCallback();

// Prevent that not run more than once
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

return {
Expand Down

0 comments on commit 514df97

Please sign in to comment.