From 5dc054ae8f7e943185f727eb5c3eb9c36cf1e866 Mon Sep 17 00:00:00 2001
From: Danny White <3104761+dnywh@users.noreply.github.com>
Date: Wed, 8 Jul 2026 04:05:19 +1000
Subject: [PATCH] feat(studio): warn in Connect sheet when Data API is disabled
(#47537)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
## What kind of change does this PR introduce?
Feature. Resolves DEPR-599.
## What is the current behavior?
When the Data API is disabled (PostgREST has no exposed schemas), the
Connect sheet still shows client-library setup steps for Framework and
MCP modes without indicating that database queries will fail.
## What is the new behavior?
When database access via the Connect instructions requires PostgREST, an
inline warning appears above the steps (setup instructions remain
visible):
- **Framework**: warns when Data API is off; install, env vars, and
auth/SSR setup still work
- **MCP**: warns only when Database tools apply (selected explicitly, or
by default when no feature filter is set)
The warning fails open if PostgREST config cannot be loaded, and links
to Data API settings via an "Enable Data API" CTA.
| After |
| --- |
| |
## Additional context
- Gating logic lives in `ConnectStepsSection.utils.ts` with unit tests
- Out of scope: warning when Data API is on but zero tables/schemas are
exposed
- Coexists with the upcoming warehouse branch's catalog warning — that
lives in a separate `WarehouseCatalogPanel` for `catalog` mode only
## Summary by CodeRabbit
* **New Features**
* Connection setup now checks Data API enablement and conditionally
shows a “Data API disabled” warning, including an action to open Data
API settings.
* **Bug Fixes**
* Warning logic now more accurately reflects the selected connection
mode and chosen feature/tool selections.
* **Tests**
* Added a focused test suite covering the Data API configuration
decision rules and when the warning should appear.
---
.../ConnectSheet/ConnectStepsSection.tsx | 36 +++++++
.../ConnectStepsSection.utils.test.ts | 98 +++++++++++++++++++
.../ConnectSheet/ConnectStepsSection.utils.ts | 20 ++++
apps/studio/hooks/misc/useIsDataApiEnabled.ts | 10 +-
4 files changed, 162 insertions(+), 2 deletions(-)
create mode 100644 apps/studio/components/interfaces/ConnectSheet/ConnectStepsSection.utils.test.ts
create mode 100644 apps/studio/components/interfaces/ConnectSheet/ConnectStepsSection.utils.ts
diff --git a/apps/studio/components/interfaces/ConnectSheet/ConnectStepsSection.tsx b/apps/studio/components/interfaces/ConnectSheet/ConnectStepsSection.tsx
index 5eee915f9dd..717a0db9b16 100644
--- a/apps/studio/components/interfaces/ConnectSheet/ConnectStepsSection.tsx
+++ b/apps/studio/components/interfaces/ConnectSheet/ConnectStepsSection.tsx
@@ -15,6 +15,10 @@ import type {
StepContentProps,
} from './Connect.types'
import { ConnectSheetStep } from './ConnectSheetStep'
+import {
+ shouldFetchDataApiConfig,
+ shouldShowDataApiDisabledWarning,
+} from './ConnectStepsSection.utils'
import { CopyPromptAdmonition } from './CopyPromptAdmonition'
import { buildConnectionStringPooler, getConnectionStrings } from './DatabaseSettings.utils'
import { getAddons } from '@/components/interfaces/Billing/Subscription/Subscription.utils'
@@ -25,6 +29,7 @@ import { useSupavisorConfigurationQuery } from '@/data/database/supavisor-config
import { useProjectAddonsQuery } from '@/data/subscriptions/project-addons-query'
import { useCheckEntitlements } from '@/hooks/misc/useCheckEntitlements'
import { useDeploymentMode } from '@/hooks/misc/useDeploymentMode'
+import { useIsDataApiEnabled } from '@/hooks/misc/useIsDataApiEnabled'
import { DOCS_URL } from '@/lib/constants'
import { pluckObjectFields } from '@/lib/helpers'
@@ -225,6 +230,23 @@ export function ConnectStepsSection({ steps, state, projectKeys }: ConnectStepsS
const showSelfHostedMcpNotice = deploymentMode.isSelfHosted && state.mode === 'mcp'
+ const shouldFetchDataApiStatus = shouldFetchDataApiConfig({
+ mode: state.mode,
+ })
+ const {
+ isEnabled: isDataApiEnabled,
+ isPending: isDataApiConfigPending,
+ isError: isDataApiConfigError,
+ } = useIsDataApiEnabled({
+ projectRef: ref,
+ enabled: shouldFetchDataApiStatus,
+ })
+ const showDataApiDisabledWarning = shouldShowDataApiDisabledWarning({
+ mode: state.mode,
+ isDataApiEnabled,
+ isPending: isDataApiConfigPending,
+ isError: isDataApiConfigError,
+ })
if (steps.length === 0) return null
return (
@@ -232,6 +254,20 @@ export function ConnectStepsSection({ steps, state, projectKeys }: ConnectStepsS