Skip to content

Commit 1ddf59f

Browse files
committed
W-21356212: Addressing comments
1 parent 93dabdb commit 1ddf59f

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

packages/template-retail-react-app/app/pages/checkout/partials/sf-payments-sheet.jsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -522,16 +522,6 @@ const SFPaymentsSheet = forwardRef((props, ref) => {
522522
() => transformPaymentMethodReferences(customer, paymentConfig),
523523
[customer, paymentConfig]
524524
)
525-
// Stable key so we only re-init when SPM list actually changes.
526-
const savedPaymentMethodsKey = useMemo(
527-
() =>
528-
(savedPaymentMethods ?? [])
529-
.map((pm) => pm?.gatewayTokenId)
530-
.filter(Boolean)
531-
.sort()
532-
.join(','),
533-
[savedPaymentMethods]
534-
)
535525

536526
useEffect(() => {
537527
// Mount SFP only when all required data and DOM are ready; otherwise skip or wait for a later run.
@@ -599,14 +589,15 @@ const SFPaymentsSheet = forwardRef((props, ref) => {
599589
checkoutComponent.current?.destroy()
600590
checkoutComponent.current = null
601591
}
592+
// Omit savedPaymentMethodsKey: init once with current SPM; re-initing when SPM list changes
593+
// causes Stripe/Adyen to complain.
602594
}, [
603595
isCustomerDataLoading,
604596
sfp,
605597
metadata,
606598
containerElementRef.current,
607599
paymentConfig,
608-
cardCaptureAutomatic,
609-
savedPaymentMethodsKey
600+
cardCaptureAutomatic
610601
])
611602

612603
useEffect(() => {

0 commit comments

Comments
 (0)