Skip to content

Commit 302d4c6

Browse files
committed
fix: make us state selection modal dismissible
1 parent 7f2458d commit 302d4c6

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/routes/(console)/organization-[organization]/billing/paymentMethods.svelte

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
let showUpdateState = $state(false);
5555
let isSelectedBackup = $state(false);
5656
let paymentMethodNeedingState: Models.PaymentMethod | null = $state(null);
57+
let dismissedPaymentMethodIds = $state<string[]>([]);
5758
5859
const hasPaymentError = $derived.by(() => {
5960
return (
@@ -117,7 +118,8 @@
117118
(method: Models.PaymentMethod) =>
118119
method?.country?.toLowerCase() === 'us' &&
119120
(!method.state || method.state.trim() === '') &&
120-
!!method.last4
121+
!!method.last4 &&
122+
!dismissedPaymentMethodIds.includes(method.$id)
121123
);
122124
123125
if (usMethodWithoutState) {
@@ -129,6 +131,10 @@
129131
130132
$effect(() => {
131133
if (!showUpdateState && paymentMethodNeedingState) {
134+
dismissedPaymentMethodIds = [
135+
...dismissedPaymentMethodIds,
136+
paymentMethodNeedingState.$id
137+
];
132138
paymentMethodNeedingState = null;
133139
}
134140
});

0 commit comments

Comments
 (0)