Skip to content

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

chore(docs): remove preview build shortcuts (#28641)

Charis220915094cac
diff --git a/apps/docs/features/app.providers.tsx b/apps/docs/features/app.providers.tsx
index ccf1b127bec..17a6e75b238 100644
--- a/apps/docs/features/app.providers.tsx
+++ b/apps/docs/features/app.providers.tsx
@@ -8,7 +8,6 @@ import SiteLayout from '~/layouts/SiteLayout'
import { AuthContainer } from './auth/auth.client'
import { DocsCommandMenu } from './command'
import { QueryClientProvider } from './data/queryClient.client'
-import { ShortcutPreviewBuild } from './envs/staging.client'
import { PageTelemetry } from './telemetry/telemetry.client'
import { ScrollRestoration } from './ui/helpers.scroll.client'
import { ThemeSandbox } from './ui/theme.client'
@@ -18,27 +17,25 @@ import { ThemeSandbox } from './ui/theme.client'
*/
function GlobalProviders({ children }: PropsWithChildren) {
return (
- <ShortcutPreviewBuild>
- <QueryClientProvider>
- <AuthContainer>
- <PageTelemetry />
- <ScrollRestoration />
- <ThemeProvider defaultTheme="system" enableSystem disableTransitionOnChange>
- <CommandProvider>
- <div className="flex flex-col">
- <SiteLayout>
- <PortalToast />
- <PromoToast />
- {children}
- <DocsCommandMenu />
- </SiteLayout>
- <ThemeSandbox />
- </div>
- </CommandProvider>
- </ThemeProvider>
- </AuthContainer>
- </QueryClientProvider>
- </ShortcutPreviewBuild>
+ <QueryClientProvider>
+ <AuthContainer>
+ <PageTelemetry />
+ <ScrollRestoration />
+ <ThemeProvider defaultTheme="system" enableSystem disableTransitionOnChange>
+ <CommandProvider>
+ <div className="flex flex-col">
+ <SiteLayout>
+ <PortalToast />
+ <PromoToast />
+ {children}
+ <DocsCommandMenu />
+ </SiteLayout>
+ <ThemeSandbox />
+ </div>
+ </CommandProvider>
+ </ThemeProvider>
+ </AuthContainer>
+ </QueryClientProvider>
)
}
diff --git a/apps/docs/features/envs/staging.client.tsx b/apps/docs/features/envs/staging.client.tsx
deleted file mode 100644
index 75ee063054a..00000000000
--- a/apps/docs/features/envs/staging.client.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-'use client'
-
-import { type PropsWithChildren, useEffect, useState } from 'react'
-import { BUILD_PREVIEW_HTML, IS_PREVIEW } from '~/lib/constants'
-
-/**
- * Preview builds don't need to be statically generated to optimize performance.
- * This (somewhat hacky) way of shortcutting preview builds cuts their build
- * time and speeds up the feedback loop for previewing docs changes in Vercel.
- *
- * This technically breaks the Rules of Hooks to avoid an unnecessary full-app
- * rerender in prod, but this is fine because IS_PREVIEW will never change on
- * you within a single build.
- */
-export const ShortcutPreviewBuild = ({ children }: PropsWithChildren) => {
- if (!BUILD_PREVIEW_HTML && IS_PREVIEW) {
- // eslint-disable-next-line react-hooks/rules-of-hooks
- const [isMounted, setIsMounted] = useState(false)
-
- // eslint-disable-next-line react-hooks/rules-of-hooks
- useEffect(() => {
- setIsMounted(true)
- }, [])
-
- return isMounted ? children : null
- }
-
- return children
-}
diff --git a/apps/docs/lib/constants.ts b/apps/docs/lib/constants.ts
index eb71a452e46..2903adfad85 100644
--- a/apps/docs/lib/constants.ts
+++ b/apps/docs/lib/constants.ts
@@ -4,10 +4,8 @@ export const API_URL = (
: process.env.NEXT_PUBLIC_API_URL
)?.replace(/\/platform$/, '')
export const BASE_PATH = process.env.NEXT_PUBLIC_BASE_PATH || '/docs'
-export const BUILD_PREVIEW_HTML = process.env.NEXT_PUBLIC_BUILD_PREVIEW_HTML === 'true'
export const IS_DEV = process.env.NODE_ENV === 'development'
export const IS_PLATFORM = process.env.NEXT_PUBLIC_IS_PLATFORM === 'true'
export const IS_PREVIEW = process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview'
export const LOCAL_SUPABASE = process.env.NEXT_PUBLIC_LOCAL_SUPABASE === 'true'
export const MISC_URL = process.env.NEXT_PUBLIC_MISC_URL ?? ''
-export const SKIP_BUILD_STATIC_GENERATION = process.env.SKIP_BUILD_STATIC_GENERATION === 'true'
diff --git a/apps/docs/lib/mdx/handleRefStaticPaths.tsx b/apps/docs/lib/mdx/handleRefStaticPaths.tsx
index 344c60256fa..7fa11d038f0 100644
--- a/apps/docs/lib/mdx/handleRefStaticPaths.tsx
+++ b/apps/docs/lib/mdx/handleRefStaticPaths.tsx
@@ -1,15 +1,6 @@
import type { ICommonSection } from '~/components/reference/Reference.types'
async function handleRefGetStaticPaths(sections: ICommonSection[]) {
- // In preview environments, don't generate static pages (faster builds)
- if (process.env.SKIP_BUILD_STATIC_GENERATION) {
- return {
- paths: [],
- fallback: 'blocking',
- }
- }
-
- // In production, generate static pages for every sub-section (better SEO)
return {
paths: sections.map((section) => {
return {
diff --git a/turbo.json b/turbo.json
index ad5c5da3ae3..89d5b715023 100644
--- a/turbo.json
+++ b/turbo.json
@@ -19,13 +19,7 @@
},
"docs#build": {
"dependsOn": ["^build"],
- "env": [
- "ANALYZE",
- "NEXT_PUBLIC_*",
- "NODE_ENV",
- "OPENAI_API_KEY",
- "SKIP_BUILD_STATIC_GENERATION"
- ],
+ "env": ["ANALYZE", "NEXT_PUBLIC_*", "NODE_ENV", "OPENAI_API_KEY"],
"outputs": [".next/**", "!.next/cache/**"]
},
"studio#build": {