From 2c8dd179367b6e5fd287c7c0179c226363754082 Mon Sep 17 00:00:00 2001 From: Ji Young Lee Date: Thu, 17 Oct 2024 11:01:09 +1100 Subject: [PATCH] Update to only send track event when route exists --- .../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 f5cfaf76a2..8fdf2c2f40 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: {