Skip to content

Commit ac2f1c1

Browse files
authored
fix(ui): Factor in isDefault into isSwitchable (#8077)
1 parent f5df7c7 commit ac2f1c1

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.changeset/witty-knives-ask.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/ui': patch
3+
---
4+
5+
Fix issue where default plans offered the ability to switch to annual.

packages/ui/src/components/SubscriptionDetails/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,9 @@ const SubscriptionCardActions = ({ subscription }: { subscription: BillingSubscr
375375

376376
const isSwitchable =
377377
((subscription.planPeriod === 'month' && Boolean(subscription.plan.annualMonthlyFee)) ||
378-
subscription.planPeriod === 'annual') &&
379-
subscription.status !== 'past_due';
378+
(subscription.planPeriod === 'annual' && Boolean(subscription.plan.fee))) &&
379+
subscription.status !== 'past_due' &&
380+
!subscription.plan.isDefault;
380381
const isFree = isFreePlan(subscription.plan);
381382
const isCancellable = subscription.canceledAt === null && !isFree;
382383
const isReSubscribable = subscription.canceledAt !== null && !isFree;

0 commit comments

Comments
 (0)