From a020be54c0d18e06ea2f59398f2e6ac4e846867f Mon Sep 17 00:00:00 2001 From: Alaister Young Date: Mon, 6 Apr 2026 18:05:24 +0800 Subject: [PATCH] fix(studio): use hook for org in NoProjectsOnPaidOrgInfo (#44572) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to #44562 – the org prop wasn't actually being passed in, so `NoProjectsOnPaidOrgInfo` was always returning null. Switched to `useSelectedOrganizationQuery` hook instead. ## To test - Go to an org on a paid plan with no projects - Verify the admonition banner appears on the general settings page ## Summary by CodeRabbit * **Refactor** * Simplified component architecture by replacing prop-based organization retrieval with hook-based approach, reducing component coupling and improving maintainability. Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) --- .../interfaces/Billing/NoProjectsOnPaidOrgInfo.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/apps/studio/components/interfaces/Billing/NoProjectsOnPaidOrgInfo.tsx b/apps/studio/components/interfaces/Billing/NoProjectsOnPaidOrgInfo.tsx index 79006d1ab0a..8411f59f79a 100644 --- a/apps/studio/components/interfaces/Billing/NoProjectsOnPaidOrgInfo.tsx +++ b/apps/studio/components/interfaces/Billing/NoProjectsOnPaidOrgInfo.tsx @@ -2,15 +2,12 @@ import Link from 'next/link' import { Admonition } from 'ui-patterns' import { useOrgProjectsInfiniteQuery } from '@/data/projects/org-projects-infinite-query' -import type { Organization } from '@/types' - -interface NoProjectsOnPaidOrgInfoProps { - organization?: Organization -} +import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization' const EXCLUDED_PLANS = ['free', 'platform', 'enterprise'] -export const NoProjectsOnPaidOrgInfo = ({ organization }: NoProjectsOnPaidOrgInfoProps) => { +export const NoProjectsOnPaidOrgInfo = () => { + const { data: organization } = useSelectedOrganizationQuery() const isEligible = organization != null && !EXCLUDED_PLANS.includes(organization.plan.id ?? '') const { data } = useOrgProjectsInfiniteQuery(