From bc98e11c96040416cff2ea874c4da9b3e1e50713 Mon Sep 17 00:00:00 2001 From: katspaugh Date: Tue, 28 Nov 2023 18:10:58 +0100 Subject: [PATCH] Refactor: poll messages based on messagesTag --- src/hooks/loadables/useLoadSafeMessages.ts | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/hooks/loadables/useLoadSafeMessages.ts b/src/hooks/loadables/useLoadSafeMessages.ts index 767bf5a0aa..7c695b39d8 100644 --- a/src/hooks/loadables/useLoadSafeMessages.ts +++ b/src/hooks/loadables/useLoadSafeMessages.ts @@ -5,21 +5,11 @@ import type { SafeMessageListPage } from '@safe-global/safe-gateway-typescript-s import useAsync from '@/hooks/useAsync' import { logError, Errors } from '@/services/exceptions' import useSafeInfo from '@/hooks/useSafeInfo' -import { POLLING_INTERVAL } from '@/config/constants' -import useIntervalCounter from '@/hooks/useIntervalCounter' import type { AsyncResult } from '@/hooks/useAsync' export const useLoadSafeMessages = (): AsyncResult => { const { safe, safeAddress, safeLoaded } = useSafeInfo() - // TODO: Remove manual polling when messagesTag is no longer cached on the backend - const [pollCount, resetPolling] = useIntervalCounter(POLLING_INTERVAL) - - // Reset the counter when safe address/chainId changes - useEffect(() => { - resetPolling() - }, [resetPolling, safeAddress, safe.chainId]) - const [data, error, loading] = useAsync( () => { if (!safeLoaded) { @@ -28,13 +18,7 @@ export const useLoadSafeMessages = (): AsyncResult => { return getSafeMessages(safe.chainId, safeAddress) }, // eslint-disable-next-line react-hooks/exhaustive-deps - [ - safeLoaded, - safe.chainId, - safeAddress, - // safe.messagesTag, - pollCount, - ], + [safeLoaded, safe.chainId, safeAddress, safe.messagesTag], false, )