Skip to content

Commit f4e41c2

Browse files
committed
fix(web): wrap useSearchParams in Suspense boundary
Wrap the checkout success page content in a Suspense boundary as required by Next.js 14 for useSearchParams hook.
1 parent 76a6c5f commit f4e41c2

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

  • apps/web/src/app/checkout/success

apps/web/src/app/checkout/success/page.tsx

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

3-
import { useEffect, useState } from "react";
3+
import { Suspense, useEffect, useState } from "react";
44
import { useSearchParams } from "next/navigation";
55
import Link from "next/link";
66
import { CheckCircle2, Loader2, ArrowRight, Sparkles } from "lucide-react";
77
import { Button } from "@/components/ui/button";
88
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
99

10-
export default function CheckoutSuccessPage() {
10+
function CheckoutSuccessContent() {
1111
const searchParams = useSearchParams();
1212
const [isVerifying, setIsVerifying] = useState(true);
1313
const [error, setError] = useState<string | null>(null);
@@ -140,3 +140,26 @@ export default function CheckoutSuccessPage() {
140140
</div>
141141
);
142142
}
143+
144+
function LoadingFallback() {
145+
return (
146+
<div className="min-h-screen flex items-center justify-center bg-gradient-to-b from-background to-muted/30">
147+
<Card className="w-full max-w-md mx-4">
148+
<CardContent className="pt-6">
149+
<div className="flex flex-col items-center text-center space-y-4">
150+
<Loader2 className="h-12 w-12 text-primary animate-spin" />
151+
<h2 className="text-xl font-semibold">Loading...</h2>
152+
</div>
153+
</CardContent>
154+
</Card>
155+
</div>
156+
);
157+
}
158+
159+
export default function CheckoutSuccessPage() {
160+
return (
161+
<Suspense fallback={<LoadingFallback />}>
162+
<CheckoutSuccessContent />
163+
</Suspense>
164+
);
165+
}

0 commit comments

Comments
 (0)