Skip to content

Commit fa8abb7

Browse files
author
Deepak Pandey
committed
Fix build errors: ESLint warnings and Suspense boundary
- Fix useCallback dependency array by removing unnecessary firstName/lastName dependencies - Wrap useSearchParams in Suspense boundary to fix Next.js build error - Refactor CompleteProfile component into CompleteProfileContent with Suspense wrapper - Add proper loading fallback for Suspense boundary - Resolve all build and linting issues for production deployment
1 parent cd0d39a commit fa8abb7

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

app/complete-profile/page.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client';
22

3-
import { useState, useEffect, useCallback, useRef } from 'react';
3+
import { useState, useEffect, useCallback, useRef, Suspense } from 'react';
44
import { useRouter, useSearchParams } from 'next/navigation';
55
import Link from 'next/link';
66
import { createClient } from '@/lib/supabase/client';
@@ -22,7 +22,7 @@ interface User {
2222
};
2323
}
2424

25-
export default function CompleteProfile() {
25+
function CompleteProfileContent() {
2626
const router = useRouter();
2727
const searchParams = useSearchParams();
2828
const returnUrl = searchParams.get('returnUrl') || '/protected/dashboard';
@@ -125,7 +125,7 @@ export default function CompleteProfile() {
125125
} finally {
126126
setIsValidating(false);
127127
}
128-
}, [router, firstName, lastName]);
128+
}, [router, returnUrl]);
129129

130130
useEffect(() => {
131131
checkUser();
@@ -490,3 +490,19 @@ export default function CompleteProfile() {
490490
</div>
491491
);
492492
}
493+
494+
export default function CompleteProfile() {
495+
return (
496+
<Suspense fallback={
497+
<div className="min-h-screen flex items-center justify-center bg-gradient-to-br from-background via-muted/30 to-muted/50">
498+
<div className="relative">
499+
<div className="animate-spin rounded-full h-12 w-12 border-4 border-primary border-t-transparent"></div>
500+
<div className="absolute inset-0 rounded-full border-4 border-primary/20 animate-ping"></div>
501+
</div>
502+
<span className="ml-4 text-lg text-muted-foreground">Loading...</span>
503+
</div>
504+
}>
505+
<CompleteProfileContent />
506+
</Suspense>
507+
);
508+
}

0 commit comments

Comments
 (0)