Skip to content

Commit de825d5

Browse files
committed
chore: trim verbose comments in next.js upgrade
The force-dynamic export name is self-documenting; the remaining env.ts comment is tightened to the essential WHY (why we don't use next-runtime-env's helper).
1 parent 3abdafc commit de825d5

4 files changed

Lines changed: 4 additions & 17 deletions

File tree

apps/sim/app/(landing)/privacy/page.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import Link from 'next/link'
33
import { getEnv } from '@/lib/core/config/env'
44
import { ExternalRedirect, LegalLayout } from '@/app/(landing)/components'
55

6-
/** Opt out of static prerendering so `NEXT_PUBLIC_PRIVACY_URL` is read from
7-
* the live runtime environment (e.g. Docker-injected) rather than baked at build. */
86
export const dynamic = 'force-dynamic'
97

108
export const metadata: Metadata = {

apps/sim/app/(landing)/terms/page.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import Link from 'next/link'
33
import { getEnv } from '@/lib/core/config/env'
44
import { ExternalRedirect, LegalLayout } from '@/app/(landing)/components'
55

6-
/** Opt out of static prerendering so `NEXT_PUBLIC_TERMS_URL` is read from
7-
* the live runtime environment (e.g. Docker-injected) rather than baked at build. */
86
export const dynamic = 'force-dynamic'
97

108
export const metadata: Metadata = {

apps/sim/app/manifest.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import type { MetadataRoute } from 'next'
22
import { getBrandConfig } from '@/ee/whitelabeling'
33

4-
/** Opt out of static prerendering so `NEXT_PUBLIC_BRAND_*` is read from
5-
* the live runtime environment (e.g. Docker-injected) rather than baked at build. */
64
export const dynamic = 'force-dynamic'
75

86
export default function manifest(): MetadataRoute.Manifest {

apps/sim/lib/core/config/env.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,10 @@ import { createEnv } from '@t3-oss/env-nextjs'
22
import { z } from 'zod'
33

44
/**
5-
* Universal environment variable getter that works in both client and server contexts.
6-
* - Client-side: reads from `window.__ENV`, which `<PublicEnvScript>` from
7-
* next-runtime-env populates before hydration (declared globally by that
8-
* package). Supports Docker runtime injection of `NEXT_PUBLIC_*` vars
9-
* without rebuilding.
10-
* - Server-side: reads `process.env` directly.
11-
*
12-
* We deliberately do not import next-runtime-env's `env()` helper. It calls
13-
* `unstable_noStore()` from `next/cache`, which Next 16.2+ rejects when
14-
* invoked outside a request scope (e.g. during `next.config.ts` compilation
15-
* or top-level module evaluation).
5+
* Reads NEXT_PUBLIC_* env vars in both client and server contexts.
6+
* Client reads `window.__ENV` (populated by `<PublicEnvScript>`); server reads `process.env`.
7+
* We do not use next-runtime-env's `env()` helper because it calls `unstable_noStore()`,
8+
* which Next 16.2+ rejects outside a request scope.
169
*/
1710
const getEnv = (variable: string): string | undefined => {
1811
if (typeof window === 'undefined') return process.env[variable]

0 commit comments

Comments
 (0)