From 514df970cc1c9cd7076bffa0bd7f8269db138263 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Vin=C3=ADcius?= <dev.pablo.vinicius@gmail.com>
Date: Mon, 15 Mar 2021 01:57:00 -0300
Subject: [PATCH] fix: hooks dependencies

---
 reactools/src/hooks/useAsync/useAsync.ts | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/reactools/src/hooks/useAsync/useAsync.ts b/reactools/src/hooks/useAsync/useAsync.ts
index 7a73b0ca..a924daa1 100644
--- a/reactools/src/hooks/useAsync/useAsync.ts
+++ b/reactools/src/hooks/useAsync/useAsync.ts
@@ -61,7 +61,7 @@ export function useAsync<T = any>(
 
         resolve(callbackCalled);
       }),
-    [],
+    [context],
   );
 
   const handleCallback = useCallback(async (): Promise<void> => {
@@ -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 {