diff --git a/src/components/transactions/TxListItem/ExpandableTransactionItem.tsx b/src/components/transactions/TxListItem/ExpandableTransactionItem.tsx index 3ce303c01d..ccec3c0d20 100644 --- a/src/components/transactions/TxListItem/ExpandableTransactionItem.tsx +++ b/src/components/transactions/TxListItem/ExpandableTransactionItem.tsx @@ -5,7 +5,7 @@ import TxSummary from '@/components/transactions/TxSummary' import TxDetails from '@/components/transactions/TxDetails' import CreateTxInfo from '@/components/transactions/SafeCreationTx' import { isCreationTxInfo } from '@/utils/transaction-guards' -import { useContext, useRef } from 'react' +import { useContext } from 'react' import { BatchExecuteHoverContext } from '@/components/transactions/BatchExecuteButton/BatchExecuteHoverProvider' import css from './styles.module.css' import classNames from 'classnames' @@ -23,7 +23,6 @@ export const ExpandableTransactionItem = ({ txDetails, testId, }: ExpandableTransactionItemProps & { testId?: string }) => { - const wasOpened = useRef(false) const hoverContext = useContext(BatchExecuteHoverContext) const isBatched = hoverContext.activeHover.includes(item.transaction.id) @@ -39,10 +38,9 @@ export const ExpandableTransactionItem = ({ defaultExpanded={!!txDetails} className={classNames({ [css.batched]: isBatched })} data-testid={testId} - onChange={() => { - if (!wasOpened.current) { + onChange={(_, expanded) => { + if (expanded) { trackEvent(TX_LIST_EVENTS.EXPAND_TRANSACTION) - wasOpened.current = true } }} >