fix: refresh payment methods after user adds a payment method

If methods doesn't include the paymentMethodId, the Payment method input will show "No saved payment methods".

Since paymentMethodId gets set after a user adds their payment method, we can listen for when it's set and fetch the methods if the newly added payment method isn't in the original list of payment methods.
This commit is contained in:
Steven Nguyen committed 2025-06-02 15:29:04 -07:00
1 parent b380583162
commit d995672be5
1 file changed
+8
@@ -255,6 +255,14 @@
})();
}
}
// after adding a payment method, fetch the payment methods again so the input can be updated
$: if (
paymentMethodId &&
!methods?.paymentMethods?.find((method) => method.$id === paymentMethodId)
) {
loadPaymentMethods();
}
</script>
<svelte:head>