Skip to content

Commit

Permalink
fix: Track every accordion open
Browse files Browse the repository at this point in the history
  • Loading branch information
usame-algan committed Oct 12, 2023
1 parent 8f61a7e commit 50dbcc0
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -23,7 +23,6 @@ export const ExpandableTransactionItem = ({
txDetails,
testId,
}: ExpandableTransactionItemProps & { testId?: string }) => {
const wasOpened = useRef<boolean>(false)
const hoverContext = useContext(BatchExecuteHoverContext)

const isBatched = hoverContext.activeHover.includes(item.transaction.id)
Expand All @@ -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
}
}}
>
Expand Down

0 comments on commit 50dbcc0

Please sign in to comment.