From 5b321fab5278e5c70b31a8d8a6bc5bc240b694de Mon Sep 17 00:00:00 2001 From: Ji Young Lee <641712+jiyounglee@users.noreply.github.com> Date: Thu, 17 Oct 2024 13:52:04 +1100 Subject: [PATCH] [NO CHANGELOGS] [Add Funds Widget] Update to only send track event when route exists (#2322) --- .../src/widgets/add-funds/views/AddFunds.tsx | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/packages/checkout/widgets-lib/src/widgets/add-funds/views/AddFunds.tsx b/packages/checkout/widgets-lib/src/widgets/add-funds/views/AddFunds.tsx index 479e4f1d52..d8fc7b8332 100644 --- a/packages/checkout/widgets-lib/src/widgets/add-funds/views/AddFunds.tsx +++ b/packages/checkout/widgets-lib/src/widgets/add-funds/views/AddFunds.tsx @@ -172,20 +172,22 @@ export function AddFunds({ }; const setSelectedRouteData = (route: RouteData | undefined) => { - track({ - userJourney: UserJourney.ADD_FUNDS, - screen: 'InputScreen', - control: 'RoutesMenu', - controlType: 'MenuItem', - extras: { - toTokenAddress: route?.amountData.toToken.address, - toTokenChainId: route?.amountData.toToken.chainId, - fromTokenAddress: route?.amountData.fromToken.address, - fromTokenChainId: route?.amountData.fromToken.chainId, - toAmount: route?.amountData.toAmount, - fromAmount: route?.amountData.fromAmount, - }, - }); + if (route) { + track({ + userJourney: UserJourney.ADD_FUNDS, + screen: 'InputScreen', + control: 'RoutesMenu', + controlType: 'MenuItem', + extras: { + toTokenAddress: route.amountData.toToken.address, + toTokenChainId: route.amountData.toToken.chainId, + fromTokenAddress: route.amountData.fromToken.address, + fromTokenChainId: route.amountData.fromToken.chainId, + toAmount: route.amountData.toAmount, + fromAmount: route.amountData.fromAmount, + }, + }); + } addFundsDispatch({ payload: {