Skip to content

feat(ui): show management button for plans without base fee#8375

Open
mauricioabreu wants to merge 1 commit intomainfrom
mauricio-antunes/bill-1746-manage-button-not-being-displayed
Open

feat(ui): show management button for plans without base fee#8375
mauricioabreu wants to merge 1 commit intomainfrom
mauricio-antunes/bill-1746-manage-button-not-being-displayed

Conversation

@mauricioabreu
Copy link
Copy Markdown
Contributor

Today, the Manage Subscription button in / , and the Cancel / Re-subscribe actions inside , are gated by !plan.hasBaseFee. That predicate was originally shorthand for "this is the free fallback plan, there's nothing the user can do with it". with seat-based billing, however, a plan can have no base fee and still be a real paid subscription (the cost comes entirely from the seat unit prices), so the UI was hiding actions users need

Description

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 22, 2026

🦋 Changeset detected

Latest commit: 7654711

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@clerk/ui Patch
@clerk/chrome-extension Patch

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

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Apr 22, 2026 11:34pm

Request Review

@github-actions github-actions Bot added the ui label Apr 22, 2026
@mauricioabreu mauricioabreu marked this pull request as ready for review April 22, 2026 15:38
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: fbf37323-1c5f-4d09-bf6e-badc2297fd93

📥 Commits

Reviewing files that changed from the base of the PR and between d02bd0b and 7654711.

📒 Files selected for processing (4)
  • .changeset/billing-manage-subscription-seat-based.md
  • packages/ui/src/components/SubscriptionDetails/index.tsx
  • packages/ui/src/components/Subscriptions/SubscriptionsList.tsx
  • packages/ui/src/utils/billingSubscription.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/ui/src/utils/billingSubscription.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • .changeset/billing-manage-subscription-seat-based.md
  • packages/ui/src/components/Subscriptions/SubscriptionsList.tsx

📝 Walkthrough

Walkthrough

A new utility, isManageableSubscriptionItem(subscriptionItem), is added and exported from packages/ui/src/utils/billingSubscription.ts; it defines manageability as !subscriptionItem.plan.isDefault. The SubscriptionDetails and SubscriptionsList components now use this helper to decide whether management actions (manage/switch/cancel/re-subscribe) and the manage-subscription button are shown, replacing prior local checks that relied on plan base-fee and free-plan heuristics. A changeset documenting the UI behavior update was added.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: updating the management button visibility logic to show it for plans without a base fee (when they are manageable), which directly aligns with the seat-based billing fix.
Description check ✅ Passed The description clearly explains the problem (hasBaseFee predicate was incorrect for seat-based billing), the motivation (plans without base fee can still be paid), and the solution (show management actions for non-free payable plans).
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/ui/src/utils/billingSubscription.ts`:
- Around line 15-16: Add regression tests for the new predicate
isManageableSubscriptionItem(BillingSubscriptionItemResource) covering at least:
(1) a default-plan item where plan.isDefault === true and the predicate returns
false, and (2) paid seat-based and paid no-base-fee items where plan.isDefault
=== false and the predicate returns true. Also add integration-level assertions
that the UI paths which rely on this helper (the action visibility
logic/components that call isManageableSubscriptionItem) show or hide the
management actions appropriately. Ensure tests exercise the helper directly and
via the consuming UI visibility logic so future changes to
isManageableSubscriptionItem are caught.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 22136a0a-d6e8-4522-9cfc-d9ccf9a95a08

📥 Commits

Reviewing files that changed from the base of the PR and between abaa339 and d02bd0b.

📒 Files selected for processing (4)
  • .changeset/billing-manage-subscription-seat-based.md
  • packages/ui/src/components/SubscriptionDetails/index.tsx
  • packages/ui/src/components/Subscriptions/SubscriptionsList.tsx
  • packages/ui/src/utils/billingSubscription.ts

Comment on lines +15 to +16
export const isManageableSubscriptionItem = (subscriptionItem: BillingSubscriptionItemResource): boolean =>
!subscriptionItem.plan.isDefault;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add regression tests for the new manageability predicate before merge.

Line 15 introduces the shared gate used across multiple billing surfaces, but this PR ships no test updates. Please add coverage for default-plan items (not manageable) and paid seat-based/no-base-fee items (manageable), including UI action visibility paths that consume this helper.

As per coding guidelines **/*: "If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ui/src/utils/billingSubscription.ts` around lines 15 - 16, Add
regression tests for the new predicate
isManageableSubscriptionItem(BillingSubscriptionItemResource) covering at least:
(1) a default-plan item where plan.isDefault === true and the predicate returns
false, and (2) paid seat-based and paid no-base-fee items where plan.isDefault
=== false and the predicate returns true. Also add integration-level assertions
that the UI paths which rely on this helper (the action visibility
logic/components that call isManageableSubscriptionItem) show or hide the
management actions appropriately. Ensure tests exercise the helper directly and
via the consuming UI visibility logic so future changes to
isManageableSubscriptionItem are caught.

Comment on lines +420 to +422
price: normalizeFormatted(subscription.plan.fee.amountFormatted),

currency: subscription.plan.fee.currencySymbol,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed! Thanks

Today, the Manage Subscription button in <UserProfile /> /
<OrganizationProfile />, and the Cancel / Re-subscribe actions inside
<SubscriptionDetails />, are gated by !plan.hasBaseFee. That predicate
was originally shorthand for "this is the free fallback plan, there's
nothing the user can do with it". with seat-based billing, however, a
plan can have no base fee and still be a real paid
subscription (the cost comes entirely from the seat unit prices), so the
UI was hiding actions users need
@mauricioabreu mauricioabreu force-pushed the mauricio-antunes/bill-1746-manage-button-not-being-displayed branch from d6aff18 to 7654711 Compare April 22, 2026 23:33
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 22, 2026

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@8375

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@8375

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@8375

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@8375

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@8375

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@8375

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@8375

@clerk/express

npm i https://pkg.pr.new/@clerk/express@8375

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@8375

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@8375

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@8375

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@8375

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@8375

@clerk/react

npm i https://pkg.pr.new/@clerk/react@8375

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@8375

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@8375

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@8375

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@8375

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@8375

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@8375

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@8375

commit: 7654711

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants