Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: api docs crashed when navigation from graphiql (#19118)

Austin Trane66e721ad14b
diff --git a/apps/studio/components/interfaces/Docs/ResourceContent.tsx b/apps/studio/components/interfaces/Docs/ResourceContent.tsx
index 2f62e56bb22..55422ab83ae 100644
--- a/apps/studio/components/interfaces/Docs/ResourceContent.tsx
+++ b/apps/studio/components/interfaces/Docs/ResourceContent.tsx
@@ -20,11 +20,15 @@ const ResourceContent = ({
}: any) => {
const { ref } = useParams()
const { data: customDomainData } = useCustomDomainsQuery({ projectRef: ref })
+ const { realtimeAll: realtimeEnabled } = useIsFeatureEnabled(['realtime:all'])
+
const endpoint =
customDomainData?.customDomain?.status === 'active'
? `https://${customDomainData.customDomain.hostname}`
: autoApiService.endpoint
+ if (!paths || !definitions) return null
+
const keyToShow = !!showApiKey ? showApiKey : 'SUPABASE_KEY'
const resourcePaths = paths[`/${resourceId}`]
const resourceDefinition = definitions[resourceId]
@@ -37,10 +41,6 @@ const ResourceContent = ({
required: resourceDefinition?.required?.includes(id),
}))
- const { realtimeAll: realtimeEnabled } = useIsFeatureEnabled(['realtime:all'])
-
- if (!paths || !definitions) return null
-
return (
<>
<h2 className="doc-section__table-name text-foreground mt-0 flex items-center px-6 gap-2">