From 7d735bf4ac59c6755a77e1f0ea72097072bb56c7 Mon Sep 17 00:00:00 2001 From: Jhonatan Gonzalez Date: Mon, 18 Mar 2024 10:54:46 +0900 Subject: [PATCH] [GASBT-10][Sale Widget] Delay calls to smart checkout until token address is set (#1593) Co-authored-by: Mimi Tran <80493680+mimi-imtbl@users.noreply.github.com> --- .../src/widgets/sale/views/FundWithSmartCheckout.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/checkout/widgets-lib/src/widgets/sale/views/FundWithSmartCheckout.tsx b/packages/checkout/widgets-lib/src/widgets/sale/views/FundWithSmartCheckout.tsx index fbcaea02a4..2ce1cb699b 100644 --- a/packages/checkout/widgets-lib/src/widgets/sale/views/FundWithSmartCheckout.tsx +++ b/packages/checkout/widgets-lib/src/widgets/sale/views/FundWithSmartCheckout.tsx @@ -32,7 +32,7 @@ export function FundWithSmartCheckout({ subView }: FundWithSmartCheckoutProps) { >(undefined); const [fundingRouteStepIndex, setFundingRouteStepIndex] = useState(0); const { - querySmartCheckout, fundingRoutes, smartCheckoutResult, collectionName, + querySmartCheckout, fundingRoutes, smartCheckoutResult, collectionName, fromTokenAddress, } = useSaleContext(); const { cryptoFiatDispatch } = useContext(CryptoFiatContext); @@ -41,9 +41,9 @@ export function FundWithSmartCheckout({ subView }: FundWithSmartCheckoutProps) { }; useEffect(() => { - if (subView !== FundWithSmartCheckoutSubViews.INIT) return; + if (subView !== FundWithSmartCheckoutSubViews.INIT || !fromTokenAddress) return; querySmartCheckout(); - }, [subView]); + }, [subView, fromTokenAddress]); useEffect(() => { if (!cryptoFiatDispatch || !smartCheckoutResult) return;