Skip to content

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

Fix: ensure the scoped oauth apps new UI doesn't show if mocks are enabled (#51829)

Gildas Garcia09a4374b1461
diff --git a/apps/studio/components/interfaces/Organization/OAuthApps/PublishAppSidePanel/index.tsx b/apps/studio/components/interfaces/Organization/OAuthApps/PublishAppSidePanel/index.tsx
index 096a2e1552f..3a2014559f2 100644
--- a/apps/studio/components/interfaces/Organization/OAuthApps/PublishAppSidePanel/index.tsx
+++ b/apps/studio/components/interfaces/Organization/OAuthApps/PublishAppSidePanel/index.tsx
@@ -44,6 +44,7 @@ import {
import { ScopesPanel } from './Scopes'
import { DocsButton } from '@/components/ui/DocsButton'
import { Shortcut } from '@/components/ui/Shortcut'
+import { USE_MOCKS } from '@/data/oauth-apps/mocks'
import {
OAuthAppCreateResponse,
useOAuthAppCreateMutation,
@@ -113,7 +114,7 @@ export const PublishAppSidePanel = ({
}: PublishAppSidePanelProps) => {
const { slug } = useParams()
const uploadButtonRef = useRef<HTMLInputElement | null>(null)
- const areOAuthAppScopedGrantsEnabled = useFlag('OauthAppScopedGrants')
+ const areOAuthAppScopedGrantsEnabled = useFlag('OauthAppScopedGrants') && USE_MOCKS
const { mutateAsync: createOAuthApp } = useOAuthAppCreateMutation({
onSuccess: (res, variables) => {
diff --git a/apps/studio/components/layouts/AccountLayout/AccountLayout.tsx b/apps/studio/components/layouts/AccountLayout/AccountLayout.tsx
index 47ab6f3dd33..8250e451eb9 100644
--- a/apps/studio/components/layouts/AccountLayout/AccountLayout.tsx
+++ b/apps/studio/components/layouts/AccountLayout/AccountLayout.tsx
@@ -8,6 +8,7 @@ import { cn } from 'ui'
import { useMobileSheet } from '../Navigation/NavigationBar/MobileSheetContext'
import { AccountMenuContent } from './AccountMenuContent'
import { WithSidebar } from './WithSidebar'
+import { USE_MOCKS } from '@/data/oauth-apps/mocks'
import { useCustomContent } from '@/hooks/custom-content/useCustomContent'
import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
import { useLastVisitedOrganization } from '@/hooks/misc/useLastVisitedOrganization'
@@ -28,7 +29,7 @@ const AccountLayout = ({ children, title }: PropsWithChildren<AccountLayoutProps
const currentPath = router.pathname
const showSecuritySettings = useIsFeatureEnabled('account:show_security_settings')
- const showOAuthApps = useFlag('OauthAppScopedGrants')
+ const showOAuthApps = useFlag('OauthAppScopedGrants') && USE_MOCKS
const { appTitle } = useCustomContent(['app:title'])
const brandTitle = appTitle || 'Supabase'
const surfaceLabel = IS_PLATFORM ? 'Account' : 'Preferences'
diff --git a/apps/studio/pages/account/apps.tsx b/apps/studio/pages/account/apps.tsx
index 32581ed4b1a..971bd34451c 100644
--- a/apps/studio/pages/account/apps.tsx
+++ b/apps/studio/pages/account/apps.tsx
@@ -14,10 +14,11 @@ import { OAuthApps } from '@/components/interfaces/Account/OAuthApps/OAuthApps'
import AccountLayout from '@/components/layouts/AccountLayout/AccountLayout'
import { AppLayout } from '@/components/layouts/AppLayout/AppLayout'
import { DefaultLayout } from '@/components/layouts/DefaultLayout'
+import { USE_MOCKS } from '@/data/oauth-apps/mocks'
import type { NextPageWithLayout } from '@/types'
const UserOAuthApps: NextPageWithLayout = () => {
- const isOAuthAppScopedGrantsEnabled = useFlag('OauthAppScopedGrants')
+ const isOAuthAppScopedGrantsEnabled = useFlag('OauthAppScopedGrants') && USE_MOCKS
const { hasLoaded } = useFeatureFlags()
const router = useRouter()
useEffect(() => {
diff --git a/apps/studio/routeTree.gen.ts b/apps/studio/routeTree.gen.ts
index 16fc846d45c..a7aeae2a9d3 100644
--- a/apps/studio/routeTree.gen.ts
+++ b/apps/studio/routeTree.gen.ts
@@ -7434,3 +7434,13 @@ const rootRouteChildren: RootRouteChildren = {
export const routeTree = rootRouteImport
._addFileChildren(rootRouteChildren)
._addFileTypes<FileRouteTypes>()
+
+import type { getRouter } from './router.tsx'
+import type { startInstance } from './start.ts'
+declare module '@tanstack/react-start' {
+ interface Register {
+ ssr: true
+ router: Awaited<ReturnType<typeof getRouter>>
+ config: Awaited<ReturnType<typeof startInstance.getOptions>>
+ }
+}