From b28088d420bd9fb5440021b0f2db6ee99c3b2624 Mon Sep 17 00:00:00 2001 From: Jhonatan Gonzalez Date: Tue, 26 Mar 2024 12:53:52 +0900 Subject: [PATCH] fix: [Sale Widget] excludePaymentTypes param initial value (#1624) --- .../src/widgets/sale/context/SaleContextProvider.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/checkout/widgets-lib/src/widgets/sale/context/SaleContextProvider.tsx b/packages/checkout/widgets-lib/src/widgets/sale/context/SaleContextProvider.tsx index 7a2f462eff..bbe9146308 100644 --- a/packages/checkout/widgets-lib/src/widgets/sale/context/SaleContextProvider.tsx +++ b/packages/checkout/widgets-lib/src/widgets/sale/context/SaleContextProvider.tsx @@ -172,12 +172,10 @@ export function SaleContextProvider(props: { >(undefined); const [fundingRoutes, setFundingRoutes] = useState([]); - const [disabledPaymentTypes, setDisabledPaymentTypes] = useState< - SalePaymentTypes[] - >(excludePaymentTypes || []); + const [disabledPaymentTypes, setDisabledPaymentTypes] = useState([]); const disablePaymentTypes = (types: SalePaymentTypes[]) => { - setDisabledPaymentTypes((prev) => [...prev, ...types]); + setDisabledPaymentTypes((prev) => Array.from(new Set([...(prev || []), ...types]))); }; const [invalidParameters, setInvalidParameters] = useState(false);