taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 4d36b5a469e03f3485a5ea4448ad3d5bacc1f230
parent 1facde4ab16c8d943f16f7cb0ded8dc9104dacfd
Author: Sebastian <sebasjm@gmail.com>
Date:   Fri,  1 Mar 2024 12:06:02 -0300

update every second

Diffstat:
Mpackages/taler-wallet-webextension/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 @@ -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<TalerErrorDetail>() 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<NotificationType>({ length: 1 }); // listenAllEvents.includes = () => true // useEffect(() => {