From 56290c05805bd436e263f0d86c516de60905a904 Mon Sep 17 00:00:00 2001 From: Gabriel Indik Date: Fri, 15 Nov 2024 10:37:13 -0500 Subject: [PATCH] Adjust private label logic Signed-off-by: Gabriel Indik --- ui/client/src/components/Transaction.tsx | 2 +- ui/client/src/contexts/ApplicationContext.tsx | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ui/client/src/components/Transaction.tsx b/ui/client/src/components/Transaction.tsx index 0bb16cd23..8dd0b067b 100644 --- a/ui/client/src/components/Transaction.tsx +++ b/ui/client/src/components/Transaction.tsx @@ -45,7 +45,7 @@ export const Transaction: React.FC = ({ const [viewDetailsDialogOpen, setViewDetailsDialogOpen] = useState(false); const receiptCount = (transactionReceipts && transactionReceipts.length) ? transactionReceipts.length : 0; - const receiptIsPrivate = (transactionReceipts && transactionReceipts.length && transactionReceipts[0].domain !== ''); + const receiptIsPrivate = (transactionReceipts && transactionReceipts.length && transactionReceipts[0].domain !== undefined); const typeKey = receiptCount > 1 ? 'atomicNumber' : receiptIsPrivate ? 'private' : diff --git a/ui/client/src/contexts/ApplicationContext.tsx b/ui/client/src/contexts/ApplicationContext.tsx index 5685027e4..49fbffd40 100644 --- a/ui/client/src/contexts/ApplicationContext.tsx +++ b/ui/client/src/contexts/ApplicationContext.tsx @@ -26,8 +26,8 @@ interface Props { export const ApplicationContextProvider = ({ children, colorMode }: Props) => { - const [autoRefreshEnabled, setAutoRefreshEnabled] = useState(true); - const [lastBlockWithTransactions, setLastBlockWithTransactions] = useState(0); + const [autoRefreshEnabled, setAutoRefreshEnabled] = useState(false); + const [lastBlockWithTransactions, setLastBlockWithTransactions] = useState(-1); const [refreshRequired, setRefreshRequired] = useState(false); const { data: actualLastBlockWithTransactions, error } = useQuery({ @@ -43,15 +43,18 @@ export const ApplicationContextProvider = ({ children, colorMode }: Props) => { retry: false }); - useEffect(() => { + + if(actualLastBlockWithTransactions !== undefined && actualLastBlockWithTransactions > lastBlockWithTransactions) { - if(autoRefreshEnabled) { + + if(autoRefreshEnabled || lastBlockWithTransactions === -1) { setLastBlockWithTransactions(actualLastBlockWithTransactions); } else { setRefreshRequired(true); } + } }, [actualLastBlockWithTransactions, lastBlockWithTransactions, setLastBlockWithTransactions]);