Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"fumadocs-openapi": "10.3.13",
"fumadocs-ui": "16.6.7",
"lucide-react": "^0.511.0",
"next": "16.1.6",
"next": "16.2.4",
"next-themes": "^0.4.6",
"postgres": "^3.4.5",
"react": "19.2.4",
Expand Down
10 changes: 9 additions & 1 deletion apps/sim/app/(auth)/oauth/consent/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import { useCallback, useEffect, useState } from 'react'
import { Suspense, useCallback, useEffect, useState } from 'react'
import { ArrowLeftRight } from 'lucide-react'
import Image from 'next/image'
import { useRouter, useSearchParams } from 'next/navigation'
Expand All @@ -25,6 +25,14 @@ interface ClientInfo {
}

export default function OAuthConsentPage() {
return (
<Suspense fallback={null}>
<OAuthConsentInner />
</Suspense>
)
}

function OAuthConsentInner() {
const router = useRouter()
const searchParams = useSearchParams()
const { data: session } = useSession()
Expand Down
2 changes: 2 additions & 0 deletions apps/sim/app/(auth)/reset-password/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ export const metadata: Metadata = {
title: 'Reset Password',
}

export const dynamic = 'force-dynamic'

export default ResetPasswordPage
7 changes: 4 additions & 3 deletions apps/sim/app/(landing)/components/navbar/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { useCallback, useContext, useEffect, useRef, useState, useSyncExternalSt
import dynamic from 'next/dynamic'
import Image from 'next/image'
import Link from 'next/link'
import { useSearchParams } from 'next/navigation'
import { GithubOutlineIcon } from '@/components/icons'
import { cn } from '@/lib/core/utils/cn'
import { SessionContext } from '@/app/_shell/providers/session-provider'
Expand Down Expand Up @@ -52,12 +51,14 @@ interface NavbarProps {

export default function Navbar({ logoOnly = false, blogPosts = [] }: NavbarProps) {
const brand = getBrandConfig()
const searchParams = useSearchParams()
const sessionCtx = useContext(SessionContext)
const session = sessionCtx?.data ?? null
const isSessionPending = sessionCtx?.isPending ?? true
const isAuthenticated = Boolean(session?.user?.id)
const isBrowsingHome = searchParams.has('home')
const [isBrowsingHome, setIsBrowsingHome] = useState(false)
useEffect(() => {
setIsBrowsingHome(new URLSearchParams(window.location.search).has('home'))
}, [])
const useHomeLinks = isAuthenticated || isBrowsingHome
const logoHref = useHomeLinks ? '/?home' : '/'
const mounted = useSyncExternalStore(
Expand Down
2 changes: 2 additions & 0 deletions apps/sim/app/(landing)/privacy/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import Link from 'next/link'
import { getEnv } from '@/lib/core/config/env'
import { ExternalRedirect, LegalLayout } from '@/app/(landing)/components'

export const dynamic = 'force-dynamic'

export const metadata: Metadata = {
title: 'Privacy Policy',
description:
Expand Down
2 changes: 2 additions & 0 deletions apps/sim/app/(landing)/terms/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import Link from 'next/link'
import { getEnv } from '@/lib/core/config/env'
import { ExternalRedirect, LegalLayout } from '@/app/(landing)/components'

export const dynamic = 'force-dynamic'

export const metadata: Metadata = {
title: 'Terms of Service',
description:
Expand Down
2 changes: 2 additions & 0 deletions apps/sim/app/invite/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ export const metadata: Metadata = {
robots: { index: false },
}

export const dynamic = 'force-dynamic'

export default Invite
2 changes: 2 additions & 0 deletions apps/sim/app/manifest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { MetadataRoute } from 'next'
import { getBrandConfig } from '@/ee/whitelabeling'

export const dynamic = 'force-dynamic'

export default function manifest(): MetadataRoute.Manifest {
const brand = getBrandConfig()

Expand Down
2 changes: 2 additions & 0 deletions apps/sim/app/unsubscribe/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ export const metadata: Metadata = {
robots: { index: false },
}

export const dynamic = 'force-dynamic'

export default Unsubscribe
14 changes: 8 additions & 6 deletions apps/sim/lib/core/config/env.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { createEnv } from '@t3-oss/env-nextjs'
import { env as runtimeEnv } from 'next-runtime-env'
import { z } from 'zod'

/**
* Universal environment variable getter that works in both client and server contexts.
* - Client-side: Uses next-runtime-env for runtime injection (supports Docker runtime vars)
* - Server-side: Falls back to process.env when runtimeEnv returns undefined
* - Provides seamless Docker runtime variable support for NEXT_PUBLIC_ vars
* Reads NEXT_PUBLIC_* env vars in both client and server contexts.
* Client reads `window.__ENV` (populated by `<PublicEnvScript>`); server reads `process.env`.
* We do not use next-runtime-env's `env()` helper because it calls `unstable_noStore()`,
* which Next 16.2+ rejects outside a request scope.
*/
const getEnv = (variable: string) => runtimeEnv(variable) ?? process.env[variable]
const getEnv = (variable: string): string | undefined => {
if (typeof window === 'undefined') return process.env[variable]
return window.__ENV?.[variable] ?? process.env[variable]
Comment thread
waleedlatif1 marked this conversation as resolved.
}
Comment thread
waleedlatif1 marked this conversation as resolved.

// biome-ignore format: keep alignment for readability
export const env = createEnv({
Expand Down
10 changes: 5 additions & 5 deletions apps/sim/next.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { NextConfig } from 'next'
import { env, getEnv, isTruthy } from './lib/core/config/env'
import { env, isTruthy } from './lib/core/config/env'
import { isDev } from './lib/core/config/feature-flags'
import {
getChatEmbedCSPPolicy,
Expand Down Expand Up @@ -40,13 +40,13 @@ const nextConfig: NextConfig = {
hostname: 'lh3.googleusercontent.com',
},
// Brand logo domain if configured
...(getEnv('NEXT_PUBLIC_BRAND_LOGO_URL')
...(process.env.NEXT_PUBLIC_BRAND_LOGO_URL
? (() => {
try {
return [
{
protocol: 'https' as const,
hostname: new URL(getEnv('NEXT_PUBLIC_BRAND_LOGO_URL')!).hostname,
hostname: new URL(process.env.NEXT_PUBLIC_BRAND_LOGO_URL!).hostname,
},
]
} catch {
Expand All @@ -55,13 +55,13 @@ const nextConfig: NextConfig = {
})()
: []),
// Brand favicon domain if configured
...(getEnv('NEXT_PUBLIC_BRAND_FAVICON_URL')
...(process.env.NEXT_PUBLIC_BRAND_FAVICON_URL
? (() => {
try {
return [
{
protocol: 'https' as const,
hostname: new URL(getEnv('NEXT_PUBLIC_BRAND_FAVICON_URL')!).hostname,
hostname: new URL(process.env.NEXT_PUBLIC_BRAND_FAVICON_URL!).hostname,
},
]
} catch {
Expand Down
6 changes: 3 additions & 3 deletions apps/sim/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
"mongodb": "6.19.0",
"mysql2": "3.14.3",
"neo4j-driver": "6.0.1",
"next": "16.1.6",
"next": "16.2.4",
"next-mdx-remote": "^5.0.0",
"next-runtime-env": "3.3.0",
"next-themes": "^0.4.6",
Expand Down Expand Up @@ -250,8 +250,8 @@
"sharp"
],
"overrides": {
"next": "16.1.6",
"@next/env": "16.1.6",
"next": "16.2.4",
"@next/env": "16.2.4",
"drizzle-orm": "^0.45.2",
"postgres": "^3.4.5",
"react-floater": {
Expand Down
28 changes: 14 additions & 14 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
"overrides": {
"react": "19.2.4",
"react-dom": "19.2.4",
"next": "16.1.6",
"@next/env": "16.1.6",
"next": "16.2.4",
"@next/env": "16.2.4",
"drizzle-orm": "^0.45.2",
"postgres": "^3.4.5"
},
Expand Down
Loading