From 4d36b5a469e03f3485a5ea4448ad3d5bacc1f230 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 1 Mar 2024 12:06:02 -0300 Subject: update every second --- .../src/components/WalletActivity.tsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/taler-wallet-webextension/src/components/WalletActivity.tsx b/packages/taler-wallet-webextension/src/components/WalletActivity.tsx index 1dde08010..48a562098 100644 --- a/packages/taler-wallet-webextension/src/components/WalletActivity.tsx +++ b/packages/taler-wallet-webextension/src/components/WalletActivity.tsx @@ -716,12 +716,22 @@ function ErroDetailModal({ error, onClose }: { error: TalerErrorDetail, onClose: export function ActiveTasksTable({ }: {}): VNode { const { i18n } = useTranslationContext() const api = useBackendContext(); - const state = useAsyncAsHook(() => - api.wallet.call(WalletApiOperation.GetActiveTasks, {}), - ); + const state = useAsyncAsHook(() => { + return api.wallet.call(WalletApiOperation.GetActiveTasks, {}); + }); const [showError, setShowError] = useState() const tasks = state && !state.hasError ? state.response.tasks : []; + useEffect(() => { + if (!state || state.hasError) return + const lastTimeout = setTimeout(() => { + state.retry(); + }, 1000) + return () => { + clearTimeout(lastTimeout) + } + }, [tasks]) + // const listenAllEvents = Array.from({ length: 1 }); // listenAllEvents.includes = () => true // useEffect(() => { -- cgit v1.2.3