Skip to content

Comments

404 page and updating name in settings updates in DB#25

Merged
0xtaufeeq merged 1 commit intomainfrom
404-page-and-changing-name-in-settings-changes-in-DB
Jun 20, 2025
Merged

404 page and updating name in settings updates in DB#25
0xtaufeeq merged 1 commit intomainfrom
404-page-and-changing-name-in-settings-changes-in-DB

Conversation

@0xtaufeeq
Copy link
Owner

No description provided.

@0xtaufeeq 0xtaufeeq requested a review from Copilot June 20, 2025 17:35
@vercel
Copy link

vercel bot commented Jun 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hire-ai ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 20, 2025 5:35pm

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds real user data flows and a custom 404 page.

  • Introduces a useUser hook to fetch and subscribe to Supabase-authenticated user data.
  • Updates header components to display dynamic avatar, initials, name, and email.
  • Replaces mock user data in settings page with live fetch/update logic and adds a themed 404 page.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
hire-ai/hooks/use-user.ts New hook to fetch and listen for auth user and split display name
hire-ai/components/header.tsx Updated header to consume useUser and render real user info
hire-ai/app/(candidate)/header.tsx Same dynamic user display in candidate-layout header
hire-ai/app/settings/page.tsx Replaces mock user with live fetch, updates display name via Supabase auth, adds loading state
hire-ai/app/not-found.tsx Adds a styled 404 “Page Not Found” screen with navigation options
Comments suppressed due to low confidence (1)

hire-ai/hooks/use-user.ts:6

  • This hook contains critical auth logic; consider adding unit tests or integration tests to ensure correct handling of fetch errors and auth state changes.
export function useUser() {

useEffect(() => {
const fetchUser = async () => {
try {
const supabase = createClient();
Copy link

Copilot AI Jun 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider creating and reusing a single Supabase client instance outside of the effect to avoid instantiating multiple clients and improve performance.

Suggested change
const supabase = createClient();

Copilot uses AI. Check for mistakes.
@@ -52,11 +60,11 @@ export function Header() {
>
Copy link

Copilot AI Jun 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alt text is generic. For better accessibility, include the user’s full name in the alt (e.g., alt={${user.firstName} ${user.lastName}'s avatar}).

Copilot uses AI. Check for mistakes.
}

// Update local state
setUser({ ...user, ...userData });
Copy link

Copilot AI Jun 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging the current user state directly can lead to stale data if updates are concurrent. Use the functional form (setUser(prev => ({ ...prev!, ...userData }))) to ensure you’re always working with the latest state.

Suggested change
setUser({ ...user, ...userData });
setUser(prev => ({ ...prev!, ...userData }));

Copilot uses AI. Check for mistakes.
Comment on lines +57 to +60
<Link href="javascript:history.back()">
<ArrowLeft className="mr-2 h-4 w-4" />
Go Back
</Link>
Copy link

Copilot AI Jun 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a javascript: URL in href can be a security risk and isn’t recommended in Next.js. Consider using a button with an onClick handler (e.g., onClick={() => router.back()}) or programmatic navigation.

Suggested change
<Link href="javascript:history.back()">
<ArrowLeft className="mr-2 h-4 w-4" />
Go Back
</Link>
<button
onClick={() => history.back()}
className="flex items-center gap-2"
>
<ArrowLeft className="mr-2 h-4 w-4" />
Go Back
</button>

Copilot uses AI. Check for mistakes.
@0xtaufeeq 0xtaufeeq merged commit 9367eaf into main Jun 20, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant