diff options
author | Florian Dold <florian@dold.me> | 2021-12-08 11:03:50 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-12-08 11:03:50 +0100 |
commit | 73dabdf43a55849ac5ca571f938d5dd847b03404 (patch) | |
tree | 36dce04b79ff36d136a473474fb72646a50a0e86 /packages/taler-wallet-webextension/src/hooks | |
parent | 5b1f779b1289c4f195085b08218d92cfdb08848e (diff) | |
download | wallet-core-73dabdf43a55849ac5ca571f938d5dd847b03404.tar.xz |
webextension: fix useEffect dependency tracking
Diffstat (limited to 'packages/taler-wallet-webextension/src/hooks')
-rw-r--r-- | packages/taler-wallet-webextension/src/hooks/useAsyncAsHook.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/packages/taler-wallet-webextension/src/hooks/useAsyncAsHook.ts b/packages/taler-wallet-webextension/src/hooks/useAsyncAsHook.ts index 38ec5bf72..e9f03d0fa 100644 --- a/packages/taler-wallet-webextension/src/hooks/useAsyncAsHook.ts +++ b/packages/taler-wallet-webextension/src/hooks/useAsyncAsHook.ts @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { ExchangesListRespose, NotificationType } from "@gnu-taler/taler-util"; +import { NotificationType } from "@gnu-taler/taler-util"; import { useEffect, useState } from "preact/hooks"; import * as wxApi from "../wxApi"; @@ -30,7 +30,10 @@ interface HookError { export type HookResponse<T> = HookOk<T> | HookError | undefined; //"withdraw-group-finished" -export function useAsyncAsHook<T>(fn: () => Promise<T>, updateOnNotification?: Array<NotificationType>): HookResponse<T> { +export function useAsyncAsHook<T>( + fn: () => Promise<T>, + updateOnNotification?: Array<NotificationType>, +): HookResponse<T> { const [result, setHookResponse] = useState<HookResponse<T>>(undefined); useEffect(() => { async function doAsync() { @@ -46,7 +49,7 @@ export function useAsyncAsHook<T>(fn: () => Promise<T>, updateOnNotification?: A doAsync(); if (updateOnNotification && updateOnNotification.length > 0) { return wxApi.onUpdateNotification(updateOnNotification, () => { - doAsync() + doAsync(); }); } }, []); |