From 40b430309e87a3ebc70155289925107b1bcc9add Mon Sep 17 00:00:00 2001 From: Celine Sarafa Date: Thu, 11 Jan 2024 18:46:48 +0100 Subject: [PATCH] chore: reset interval --- src/contexts/W3iContext/hooks/notifyHooks.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/contexts/W3iContext/hooks/notifyHooks.ts b/src/contexts/W3iContext/hooks/notifyHooks.ts index 081a170b..556b9d40 100644 --- a/src/contexts/W3iContext/hooks/notifyHooks.ts +++ b/src/contexts/W3iContext/hooks/notifyHooks.ts @@ -49,11 +49,15 @@ export const useNotifyState = (w3iProxy: Web3InboxProxy, proxyReady: boolean) => // it takes time for handshake (watch subscriptions) to complete // load in progress state using interval until it is useEffect(() => { - if (notifyClient?.hasFinishedInitialLoad()) { - setWatchSubscriptionsComplete(true) + if(watchSubscriptionsComplete) { + return noop; } // Account for sync init const intervalId = setInterval(() => { + if (notifyClient?.hasFinishedInitialLoad()) { + setWatchSubscriptionsComplete(true) + return noop; + } refreshNotifyState() }, 100)