From 7d11535a427f04e7a46c834ab1cd4ad8b6371379 Mon Sep 17 00:00:00 2001 From: ItsMurumba Date: Thu, 5 Sep 2024 13:19:19 +0300 Subject: [PATCH] Fix autoolling to run every 5 seconds --- .../src/components/common/app.main.component.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/transaction-log/src/components/common/app.main.component.tsx b/packages/transaction-log/src/components/common/app.main.component.tsx index f774e782..bda7c048 100644 --- a/packages/transaction-log/src/components/common/app.main.component.tsx +++ b/packages/transaction-log/src/components/common/app.main.component.tsx @@ -170,12 +170,17 @@ const App: React.FC = () => { useEffect(() => { const interval = setInterval(() => { - if (timestampFilter) { - fetchTransactionLogs(timestampFilter) - } + const currentTimestamp = new Date().toISOString() + setTimestampFilter(currentTimestamp) }, 5000) return () => clearInterval(interval) + }, []) + + useEffect(() => { + if (timestampFilter) { + fetchTransactionLogs(timestampFilter) + } }, [timestampFilter, fetchTransactionLogs]) const handleTabChange = (event: React.ChangeEvent<{}>, newValue: number) => {