From 7627a14689745b0dae9dc6abb987b2bec0a9661c Mon Sep 17 00:00:00 2001 From: Christopher Howard Date: Fri, 25 Oct 2024 02:57:33 -0400 Subject: [PATCH] fix: include index when generating activity cell keys (#1735) Co-authored-by: Daniel Sinclair <4412473+DanielSinclair@users.noreply.github.com> --- .../popup/hooks/useInfiniteTransactionList.ts | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/entries/popup/hooks/useInfiniteTransactionList.ts b/src/entries/popup/hooks/useInfiniteTransactionList.ts index 854a10d704..bde0de5a1c 100644 --- a/src/entries/popup/hooks/useInfiniteTransactionList.ts +++ b/src/entries/popup/hooks/useInfiniteTransactionList.ts @@ -94,16 +94,20 @@ export const useInfiniteTransactionList = ({ return transactionsAfterCutoff; }, [currentAddressCustomNetworkTransactions, cutoff, transactions]); - const formattedTransactions = useMemo( - () => - Object.entries( - selectTransactionsByDate([ - ...pendingTransactions, - ...transactionsAfterCutoff, - ]), - ).flat(2), - [pendingTransactions, transactionsAfterCutoff], - ); + const formattedTransactions = useMemo(() => { + const pendingHashes: string[] = []; + pendingTransactions.forEach((tx) => + pendingHashes.push(`${tx.hash}_${tx.chainId}`), + ); + return Object.entries( + selectTransactionsByDate([ + ...pendingTransactions, + ...transactionsAfterCutoff.filter( + (tx) => !pendingHashes.includes(`${tx.hash}_${tx.chainId}`), + ), + ]), + ).flat(2); + }, [pendingTransactions, transactionsAfterCutoff]); const infiniteRowVirtualizer = useVirtualizer({ count: formattedTransactions?.length, @@ -116,7 +120,7 @@ export const useInfiniteTransactionList = ({ const txOrLabel = formattedTransactions[i]; return typeof txOrLabel === 'string' ? txOrLabel - : txOrLabel.hash + txOrLabel.chainId; + : txOrLabel.hash + txOrLabel.chainId + txOrLabel.status; }, [formattedTransactions], ),