From d995672be588364d81922500b5d08383444dcd7b Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Mon, 2 Jun 2025 15:21:11 -0700 Subject: [PATCH] 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. --- src/routes/(console)/apply-credit/+page.svelte | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/routes/(console)/apply-credit/+page.svelte b/src/routes/(console)/apply-credit/+page.svelte index abfe31e4c..1c86a2c5d 100644 --- a/src/routes/(console)/apply-credit/+page.svelte +++ b/src/routes/(console)/apply-credit/+page.svelte @@ -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(); + }