From 5241d7787738ed0de253448009ee66320febcb0f Mon Sep 17 00:00:00 2001 From: Alejandro Loaiza Date: Thu, 14 Nov 2024 08:56:58 +1100 Subject: [PATCH] fix: Handles case when getFundingBalanceTotalFees returns undefined (#2393) --- .../src/widgets/sale/components/OrderReview.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/checkout/widgets-lib/src/widgets/sale/components/OrderReview.tsx b/packages/checkout/widgets-lib/src/widgets/sale/components/OrderReview.tsx index 9b74122e64..a026e975e1 100644 --- a/packages/checkout/widgets-lib/src/widgets/sale/components/OrderReview.tsx +++ b/packages/checkout/widgets-lib/src/widgets/sale/components/OrderReview.tsx @@ -113,9 +113,17 @@ export function OrderReview({ return; } - const [[, fee]] = Object.entries( - getFundingBalanceTotalFees(fundingBalance), - ); + const totalFees = getFundingBalanceTotalFees(fundingBalance); + if (!totalFees) { + return; + } + + const entries = Object.entries(totalFees); + if (!entries.length) { + return; + } + + const [[, fee]] = entries; if (!fee || !fee.token) { return; }