File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
src/components/FindWalletProductTable/hooks Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change
1
+ import { useRef } from "react"
1
2
import { useTranslation } from "next-i18next"
2
3
3
4
import { FilterOption } from "@/lib/types"
@@ -35,6 +36,7 @@ import { DEFAULT_LOCALE } from "@/lib/constants"
35
36
36
37
export const useWalletFilters = ( ) : FilterOption [ ] => {
37
38
const { t } = useTranslation ( "page-wallets-find-wallet" )
39
+ const prevNetworkArray = useRef < string [ ] > ( [ ] )
38
40
return [
39
41
{
40
42
title : t ( "page-find-wallet-device" ) ,
@@ -452,7 +454,19 @@ export const useWalletFilters = (): FilterOption[] => {
452
454
filterIndex = { filterIndex }
453
455
itemIndex = { itemIndex }
454
456
inputState = { inputState }
455
- updateFilterState = { updateFilterState }
457
+ updateFilterState = { ( filterIndex , itemIndex , newInputState ) => {
458
+ const newArray = newInputState as string [ ]
459
+ const oldArray = prevNetworkArray . current
460
+ if ( newArray . length > oldArray . length ) {
461
+ trackCustomEvent ( {
462
+ eventCategory : "WalletFilterSidebar" ,
463
+ eventAction : "network" ,
464
+ eventName : newArray [ newArray . length - 1 ] ,
465
+ } )
466
+ }
467
+ prevNetworkArray . current = newArray
468
+ updateFilterState ( filterIndex , itemIndex , newInputState )
469
+ } }
456
470
/>
457
471
)
458
472
} ,
You can’t perform that action at this time.
0 commit comments