From 57531ad100a254f6919271068087e1a86a8a817a Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Thu, 21 May 2020 13:06:06 -0300 Subject: [PATCH] Fix `AssetList` metric events (#8639) The metric events in the `AssetList` component were using the `useMetricEvent` hook incorrectly. --- .../components/app/asset-list/asset-list.js | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/ui/app/components/app/asset-list/asset-list.js b/ui/app/components/app/asset-list/asset-list.js index 172704337..ad9017390 100644 --- a/ui/app/components/app/asset-list/asset-list.js +++ b/ui/app/components/app/asset-list/asset-list.js @@ -18,7 +18,20 @@ const AssetList = () => { const selectedAccountBalance = useSelector((state) => getCurrentAccountWithSendEtherInfo(state).balance) const selectedTokenAddress = useSelector((state) => state.metamask.selectedTokenAddress) const showFiat = useSelector(getShouldShowFiat) - const metricsEvent = useMetricEvent() + const selectTokenEvent = useMetricEvent({ + eventOpts: { + category: 'Navigation', + action: 'Token Menu', + name: 'Clicked Token', + }, + }) + const addTokenEvent = useMetricEvent({ + eventOpts: { + category: 'Navigation', + action: 'Token Menu', + name: 'Clicked "Add Token"', + }, + }) const { currency: primaryCurrency, @@ -56,25 +69,13 @@ const AssetList = () => { { dispatch(setSelectedToken(tokenAddress)) - metricsEvent({ - eventOpts: { - category: 'Navigation', - action: 'Token Menu', - name: 'Clicked Token', - }, - }) + selectTokenEvent() }} /> { history.push(ADD_TOKEN_ROUTE) - metricsEvent({ - eventOpts: { - category: 'Navigation', - action: 'Token Menu', - name: 'Clicked "Add Token"', - }, - }) + addTokenEvent() }} />