Skip to content

Commit 5e7204c

Browse files
committed
fix: wrap useSearchParams in Suspense to fix build error
- Add Suspense boundaries around components using useSearchParams() - Create wrapper components for sign-in and sign-up forms - Fix widget preview page to use Suspense - Prevents prerendering errors during static generation
1 parent 66f3347 commit 5e7204c

5 files changed

Lines changed: 60 additions & 6 deletions

File tree

frontend/app/login/page.tsx

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

3-
import { SignInForm } from '@/components/auth/sign-in-form'
3+
import { SignInFormWrapper } from '@/components/auth/sign-in-form-wrapper'
44
import { ThemeToggle } from '@/components/shared/theme-toggle'
55
import Link from 'next/link'
66
import Image from 'next/image'
@@ -81,7 +81,7 @@ export default function LoginPage() {
8181
animate={{ opacity: 1, y: 0 }}
8282
transition={{ duration: 0.6, delay: 0.5 }}
8383
>
84-
<SignInForm />
84+
<SignInFormWrapper />
8585
</motion.div>
8686

8787
<motion.div

frontend/app/signup/page.tsx

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

3-
import { SignUpForm } from '@/components/auth/sign-up-form'
3+
import { SignUpFormWrapper } from '@/components/auth/sign-up-form-wrapper'
44
import { ThemeToggle } from '@/components/shared/theme-toggle'
55
import Link from 'next/link'
66
import Image from 'next/image'
@@ -81,7 +81,7 @@ export default function SignupPage() {
8181
animate={{ opacity: 1, y: 0 }}
8282
transition={{ duration: 0.6, delay: 0.5 }}
8383
>
84-
<SignUpForm />
84+
<SignUpFormWrapper />
8585
</motion.div>
8686

8787
<motion.div

frontend/app/widget-preview/page.tsx

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

3-
import { useEffect, useRef } from 'react'
3+
import { useEffect, useRef, Suspense } from 'react'
44
import { useSearchParams } from 'next/navigation'
55

6-
export default function WidgetPreviewPage() {
6+
function WidgetPreviewContent() {
77
const searchParams = useSearchParams()
88
const containerRef = useRef<HTMLDivElement>(null)
99

@@ -81,3 +81,18 @@ export default function WidgetPreviewPage() {
8181
)
8282
}
8383

84+
export default function WidgetPreviewPage() {
85+
return (
86+
<Suspense fallback={
87+
<div className="flex items-center justify-center h-screen">
88+
<div className="text-center">
89+
<h1 className="text-2xl font-bold mb-2">Widget Preview</h1>
90+
<p className="text-muted-foreground">Loading...</p>
91+
</div>
92+
</div>
93+
}>
94+
<WidgetPreviewContent />
95+
</Suspense>
96+
)
97+
}
98+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'use client'
2+
3+
import { Suspense } from 'react'
4+
import { SignInForm } from './sign-in-form'
5+
6+
export function SignInFormWrapper() {
7+
return (
8+
<Suspense fallback={
9+
<div className="space-y-4">
10+
<div className="h-10 bg-muted animate-pulse rounded" />
11+
<div className="h-10 bg-muted animate-pulse rounded" />
12+
<div className="h-10 bg-muted animate-pulse rounded" />
13+
</div>
14+
}>
15+
<SignInForm />
16+
</Suspense>
17+
)
18+
}
19+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'use client'
2+
3+
import { Suspense } from 'react'
4+
import { SignUpForm } from './sign-up-form'
5+
6+
export function SignUpFormWrapper() {
7+
return (
8+
<Suspense fallback={
9+
<div className="space-y-4">
10+
<div className="h-10 bg-muted animate-pulse rounded" />
11+
<div className="h-10 bg-muted animate-pulse rounded" />
12+
<div className="h-10 bg-muted animate-pulse rounded" />
13+
<div className="h-10 bg-muted animate-pulse rounded" />
14+
</div>
15+
}>
16+
<SignUpForm />
17+
</Suspense>
18+
)
19+
}
20+

0 commit comments

Comments
 (0)