Skip to content

Commit 24c4c77

Browse files
committed
fix(prerender): wrap useSearchParams callsites for Next 16.2
Next 16.2 fails the build when a client component using useSearchParams() is statically prerendered without a Suspense boundary. - Wrap landing Navbar in Suspense (imported by /oauth/consent and other pages) - Add force-dynamic to reset-password, invite/[id], and unsubscribe pages whose client bodies call useSearchParams
1 parent e037cb8 commit 24c4c77

4 files changed

Lines changed: 24 additions & 2 deletions

File tree

apps/sim/app/(auth)/reset-password/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ export const metadata: Metadata = {
55
title: 'Reset Password',
66
}
77

8+
export const dynamic = 'force-dynamic'
9+
810
export default ResetPasswordPage

apps/sim/app/(landing)/components/navbar/navbar.tsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
'use client'
22

3-
import { useCallback, useContext, useEffect, useRef, useState, useSyncExternalStore } from 'react'
3+
import {
4+
Suspense,
5+
useCallback,
6+
useContext,
7+
useEffect,
8+
useRef,
9+
useState,
10+
useSyncExternalStore,
11+
} from 'react'
412
import dynamic from 'next/dynamic'
513
import Image from 'next/image'
614
import Link from 'next/link'
@@ -50,7 +58,15 @@ interface NavbarProps {
5058
blogPosts?: NavBlogPost[]
5159
}
5260

53-
export default function Navbar({ logoOnly = false, blogPosts = [] }: NavbarProps) {
61+
export default function Navbar(props: NavbarProps) {
62+
return (
63+
<Suspense fallback={null}>
64+
<NavbarInner {...props} />
65+
</Suspense>
66+
)
67+
}
68+
69+
function NavbarInner({ logoOnly = false, blogPosts = [] }: NavbarProps) {
5470
const brand = getBrandConfig()
5571
const searchParams = useSearchParams()
5672
const sessionCtx = useContext(SessionContext)

apps/sim/app/invite/[id]/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ export const metadata: Metadata = {
66
robots: { index: false },
77
}
88

9+
export const dynamic = 'force-dynamic'
10+
911
export default Invite

apps/sim/app/unsubscribe/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ export const metadata: Metadata = {
66
robots: { index: false },
77
}
88

9+
export const dynamic = 'force-dynamic'
10+
911
export default Unsubscribe

0 commit comments

Comments
 (0)