fix(clerk-js): Don't render switch button on default plans#8116
fix(clerk-js): Don't render switch button on default plans#8116brkalow merged 1 commit intorelease/core-2from
Conversation
🦋 Changeset detectedLatest commit: ebf8d8f The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment Tip You can disable sequence diagrams in the walkthrough.Disable the |
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/elements
@clerk/clerk-expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/clerk-react
@clerk/react-router
@clerk/remix
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/themes
@clerk/types
@clerk/upgrade
@clerk/vue
commit: |
| const isSwitchingPaidPeriod = | ||
| !subscription.plan.isDefault && | ||
| planPeriod !== subscription.planPeriod && | ||
| ((planPeriod === 'annual' && Boolean(plan.annualMonthlyFee)) || (planPeriod === 'month' && Boolean(plan.fee))); |
There was a problem hiding this comment.
❓ Looks like you fixed something additional here? Could you give a bit more context?
There was a problem hiding this comment.
oh sorry, that branch was checking planPeriod === 'annual' && Boolean(plan.annualMonthlyFee) (so, the desired plan period is annual and the plan has an annual monthly fee). I added the planPeriod === 'monthly' && Boolean(plan.fee) to account for annual-only plans.
Description
This PR fixes an issue where a "Manage Subscription" button appeared on default free plans when another plan was switched to annual. This PR updates the logic to calculate whether a period switch is allowed by factoring in the
is_defaultproperty of the subscription's plan.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change