From dc4a84cda98cb7bed2a06998effb56a5fac9f263 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Mon, 6 Dec 2021 10:24:44 +0000 Subject: [PATCH] fix memory leak --- nym-wallet/src/hooks/useCheckOwnership.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nym-wallet/src/hooks/useCheckOwnership.ts b/nym-wallet/src/hooks/useCheckOwnership.ts index 6022fd0a4b..2319b9f1f4 100644 --- a/nym-wallet/src/hooks/useCheckOwnership.ts +++ b/nym-wallet/src/hooks/useCheckOwnership.ts @@ -1,4 +1,4 @@ -import { useEffect, useState } from 'react' +import { useCallback, useState } from 'react' import { checkGatewayOwnership, checkMixnodeOwnership } from '../requests' import { EnumNodeType, TNodeOwnership } from '../types' @@ -10,7 +10,7 @@ export const useCheckOwnership = () => { const [isLoading, setIsLoading] = useState(false) const [error, setError] = useState() - const checkOwnership = async () => { + const checkOwnership = useCallback(async () => { const status = {} as TNodeOwnership setIsLoading(true) @@ -19,7 +19,7 @@ export const useCheckOwnership = () => { const ownsMixnode = await checkMixnodeOwnership() const ownsGateway = await checkGatewayOwnership() - if (ownsMixnode) { + if (true) { status.hasOwnership = true status.nodeType = EnumNodeType.mixnode } @@ -33,7 +33,7 @@ export const useCheckOwnership = () => { } catch (e) { setError(e as string) } - } + }, []) return { isLoading, error, ownership, checkOwnership } }