From 3fc23db7489ecbf80bc4d287b4650524cf71af02 Mon Sep 17 00:00:00 2001 From: Pamela Chia Date: Tue, 12 May 2026 02:38:54 +0800 Subject: [PATCH] fix(billing): block downgrade requests at the component level RequestUpgradeToBillingOwners now checks the requested plan against the viewer's current plan and renders a disabled state when the request would be a downgrade or no-op. This protects every callsite: the plan switcher (previously offered 'Request upgrade to Free' to higher-tier members), the log-drains empty state (hardcoded 'Pro' showing to Team members), the billing-metric paywall, and the custom-auth-providers fallback path. Addon-flavored requests (compute size, PITR, custom domain, IPv4, spend cap) bypass the guard because they are about feature add-ons, not plan tier changes. --- .../Subscription/PlanUpdateSidePanel.tsx | 5 ++- .../ui/RequestUpgradeToBillingOwners.tsx | 36 ++++++++++++++++--- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PlanUpdateSidePanel.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PlanUpdateSidePanel.tsx index 9babe1cb8dd..a10c866b9a0 100644 --- a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PlanUpdateSidePanel.tsx +++ b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PlanUpdateSidePanel.tsx @@ -308,7 +308,10 @@ export const PlanUpdateSidePanel = () => { Current plan ) : !canUpdateSubscription ? ( - + ) : ( { track('request_upgrade_submitted', { - requestedPlan: plan, + requestedPlan: plan as PlanRequest, addon, currentPlan, }) @@ -144,13 +153,13 @@ export const RequestUpgradeToBillingOwners = ({ const onSubmit: SubmitHandler> = async (values) => { if (!slug) return console.error('Slug is required') - sendUpgradeRequest({ slug, plan, note: values.note }) + sendUpgradeRequest({ slug, plan: plan as PlanRequest, note: values.note }) } const handleOpenChange = (isOpen: boolean) => { if (isOpen) { track('request_upgrade_modal_opened', { - requestedPlan: plan, + requestedPlan: plan as PlanRequest, addon, currentPlan, featureProposition, @@ -159,6 +168,25 @@ export const RequestUpgradeToBillingOwners = ({ setOpen(isOpen) } + if (isInvalidDirection) { + return ( + + Not available + + ) + } + return (