Skip to content

Open-source status page, incident response and uptime monitoring

fix(dashboard): show choosing state only on clicked plan (#2651)

Harsh Kumar04aefb253d76
diff --git a/apps/dashboard/src/components/data-table/billing/data-table.tsx b/apps/dashboard/src/components/data-table/billing/data-table.tsx
index a8d82e2da..326b19966 100644
--- a/apps/dashboard/src/components/data-table/billing/data-table.tsx
+++ b/apps/dashboard/src/components/data-table/billing/data-table.tsx
@@ -97,6 +97,13 @@ export function DataTable({ restrictTo }: { restrictTo?: WorkspacePlan[] }) {
}),
);
+ // Which button is in flight, derived from the running mutation.
+ const pendingPlan: WorkspacePlan | null = checkoutSessionMutation.isPending
+ ? checkoutSessionMutation.variables.plan
+ : customerPortalMutation.isPending
+ ? "free"
+ : null;
+
if (!workspace) return null;
const isTrialing = workspace.trialDaysLeft !== null;
@@ -221,7 +228,7 @@ export function DataTable({ restrictTo }: { restrictTo?: WorkspacePlan[] }) {
? isTrialing
? "On Trial"
: "Current Plan"
- : isPending
+ : pendingPlan === id
? "Choosing..."
: isIntervalSwitch
? `Switch to ${interval}`