From e298282f551e8080be88fa66d9672ce33835a736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20T=C3=B6lle?= Date: Tue, 21 Feb 2023 23:03:58 +0100 Subject: [PATCH] fix(frontend): flashing content on useAsync reload --- frontend/src/hooks/use-async.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/src/hooks/use-async.tsx b/frontend/src/hooks/use-async.tsx index 3f5e819..a254ee1 100644 --- a/frontend/src/hooks/use-async.tsx +++ b/frontend/src/hooks/use-async.tsx @@ -26,7 +26,6 @@ export const useAsync: UseAsync = ( const execute = useCallback(() => { startTransition(() => { setPending(true); - setValue(initialValue); setError(null); }); @@ -34,7 +33,7 @@ export const useAsync: UseAsync = ( .then((response) => startTransition(() => setValue(response))) .catch((err) => startTransition(() => setError(err))) .finally(() => startTransition(() => setPending(false))); - }, [asyncFunction, initialValue]); + }, [asyncFunction]); // Call execute if we want to fire it right away. // Otherwise execute can be called later, such as