Skip to content

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

chore: hide edge function examples (#39142)

Alaister Young715006c4a18a
diff --git a/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.tsx b/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.tsx
index 74aab28e1c1..2d3f39195b0 100644
--- a/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.tsx
+++ b/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.tsx
@@ -19,6 +19,7 @@ import { useEdgeFunctionQuery } from 'data/edge-functions/edge-function-query'
import { useEdgeFunctionDeleteMutation } from 'data/edge-functions/edge-functions-delete-mutation'
import { useEdgeFunctionUpdateMutation } from 'data/edge-functions/edge-functions-update-mutation'
import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { DOCS_URL } from 'lib/constants'
import {
Alert_Shadcn_,
@@ -65,6 +66,14 @@ export const EdgeFunctionDetails = () => {
'*'
)
+ const showAllEdgeFunctionInvocationExamples = useIsFeatureEnabled(
+ 'edge_functions:show_all_edge_function_invocation_examples'
+ )
+ const invocationTabs = useMemo(() => {
+ if (showAllEdgeFunctionInvocationExamples) return INVOCATION_TABS
+ return INVOCATION_TABS.filter((tab) => tab.id === 'curl' || tab.id === 'supabase-js')
+ }, [showAllEdgeFunctionInvocationExamples])
+
const { data: apiKeys } = useAPIKeysQuery({ projectRef })
const { data: settings } = useProjectSettingsV2Query({ projectRef })
const { data: customDomainData } = useCustomDomainsQuery({ projectRef })
@@ -228,13 +237,13 @@ export const EdgeFunctionDetails = () => {
<CardContent>
<Tabs defaultValue="curl" className="w-full">
<TabsList className="flex flex-wrap gap-4">
- {INVOCATION_TABS.map((tab) => (
+ {invocationTabs.map((tab) => (
<TabsTrigger key={tab.id} value={tab.id}>
{tab.label}
</TabsTrigger>
))}
</TabsList>
- {INVOCATION_TABS.map((tab) => (
+ {invocationTabs.map((tab) => (
<TabsContent key={tab.id} value={tab.id} className="mt-4">
<div className="overflow-x-auto">
<CodeBlock
diff --git a/packages/common/enabled-features/enabled-features.json b/packages/common/enabled-features/enabled-features.json
index 678d1ef7560..63bdae1417a 100644
--- a/packages/common/enabled-features/enabled-features.json
+++ b/packages/common/enabled-features/enabled-features.json
@@ -54,6 +54,7 @@
"docs:web_apps": true,
"edge_functions:show_stripe_example": true,
+ "edge_functions:show_all_edge_function_invocation_examples": true,
"feedback:docs": true,
diff --git a/packages/common/enabled-features/enabled-features.schema.json b/packages/common/enabled-features/enabled-features.schema.json
index c0a812e7b50..04c2925c8c6 100644
--- a/packages/common/enabled-features/enabled-features.schema.json
+++ b/packages/common/enabled-features/enabled-features.schema.json
@@ -197,6 +197,10 @@
"type": "boolean",
"description": "Show all the Stripe example in edge function templates in the edge functions page."
},
+ "edge_functions:show_all_edge_function_invocation_examples": {
+ "type": "boolean",
+ "description": "Show all the invocation examples in the edge function details page. (If off, it will only show cURL and Javascript invocation examples)"
+ },
"feedback:docs": {
"type": "boolean",