Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

refactor(web): Fix no-null-render: StripeSwitchPlanButton.tsx (#18232)

Ben Bachem88aa67afff7b
diff --git a/web/src/ee/features/billing/components/BillingSwitchPlanDialog.tsx b/web/src/ee/features/billing/components/BillingSwitchPlanDialog.tsx
index ca821bab38..bb365cdc2d 100644
--- a/web/src/ee/features/billing/components/BillingSwitchPlanDialog.tsx
+++ b/web/src/ee/features/billing/components/BillingSwitchPlanDialog.tsx
@@ -215,18 +215,20 @@ export const BillingSwitchPlanDialog = ({
scheduledPlanSwitch.newPlanId !==
product.stripeProductId &&
(hasValidPaymentMethod ? (
- <StripeSwitchPlanButton
- orgId={organization?.id}
- currentPlan={organization?.plan}
- newPlanTitle={product.checkout?.title}
- isLegacySubscription={isLegacySubscription}
- isUpgrade={isThisUpgrade}
- stripeProductId={product.stripeProductId}
- onProcessing={setProcessingPlanId}
- processing={
- processingPlanId === product.stripeProductId
- }
- />
+ organization?.id && (
+ <StripeSwitchPlanButton
+ orgId={organization.id}
+ currentPlan={organization?.plan}
+ newPlanTitle={product.checkout?.title}
+ isLegacySubscription={isLegacySubscription}
+ isUpgrade={isThisUpgrade}
+ stripeProductId={product.stripeProductId}
+ onProcessing={setProcessingPlanId}
+ processing={
+ processingPlanId === product.stripeProductId
+ }
+ />
+ )
) : (
<Button className="w-full" disabled>
Payment method required
@@ -237,18 +239,20 @@ export const BillingSwitchPlanDialog = ({
{!isCurrentPlan &&
!scheduledPlanSwitch &&
(hasValidPaymentMethod ? (
- <StripeSwitchPlanButton
- orgId={organization?.id}
- currentPlan={organization?.plan}
- newPlanTitle={product.checkout?.title}
- isLegacySubscription={isLegacySubscription}
- isUpgrade={isThisUpgrade}
- stripeProductId={product.stripeProductId}
- onProcessing={setProcessingPlanId}
- processing={
- processingPlanId === product.stripeProductId
- }
- />
+ organization?.id && (
+ <StripeSwitchPlanButton
+ orgId={organization.id}
+ currentPlan={organization?.plan}
+ newPlanTitle={product.checkout?.title}
+ isLegacySubscription={isLegacySubscription}
+ isUpgrade={isThisUpgrade}
+ stripeProductId={product.stripeProductId}
+ onProcessing={setProcessingPlanId}
+ processing={
+ processingPlanId === product.stripeProductId
+ }
+ />
+ )
) : (
<Button className="w-full" disabled>
Payment method required
diff --git a/web/src/ee/features/billing/components/StripeSwitchPlanButton.tsx b/web/src/ee/features/billing/components/StripeSwitchPlanButton.tsx
index 79b3e98dc0..25b5ee8f54 100644
--- a/web/src/ee/features/billing/components/StripeSwitchPlanButton.tsx
+++ b/web/src/ee/features/billing/components/StripeSwitchPlanButton.tsx
@@ -1,5 +1,5 @@
/* eslint-disable no-nested-ternary */
-/* eslint-disable @repo/no-abstracted-overlay-trigger, @repo/no-null-render */
+/* eslint-disable @repo/no-abstracted-overlay-trigger */
import { useState } from "react";
import { Button } from "@/src/components/ui/button";
import {
@@ -28,7 +28,7 @@ export const StripeSwitchPlanButton = ({
onProcessing,
processing,
}: {
- orgId: string | undefined;
+ orgId: string;
currentPlan: keyof typeof planLabels | undefined;
newPlanTitle: string | undefined;
isLegacySubscription: boolean;
@@ -54,8 +54,6 @@ export const StripeSwitchPlanButton = ({
},
});
- if (!orgId) return null;
-
return (
<Dialog>
<DialogTrigger asChild>