Skip to content

wire up NavUser component to actual user data, get rid of hardcoded data - #3

Open
timothymalcham wants to merge 4 commits into
mainfrom
dev
Open

wire up NavUser component to actual user data, get rid of hardcoded data#3
timothymalcham wants to merge 4 commits into
mainfrom
dev

Conversation

@timothymalcham

Copy link
Copy Markdown
Collaborator

No description provided.

@coderabbitai

coderabbitai Bot commented Feb 1, 2026

Copy link
Copy Markdown

Walkthrough

NavUser was refactored from a prop-driven component to a session/profile-driven component. AppSidebar no longer passes a hard-coded user object and now invokes NavUser without arguments. NavUser derives name, email, avatar, and initials from authClient.useSession() and an API getCurrentUserProfile query, renders a loading skeleton while session or profile data loads, and uses computed values for Avatar, AvatarFallback, and displayed text. The exported signature changed from `NavUser({ user })` to `NavUser()`.

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No description was provided by the author, making it impossible to evaluate relevance to the changeset. Add a pull request description explaining the changes and their impact, such as how the NavUser component now derives user data from the session instead of accepting props.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'wire up NavUser component to actual user data, get rid of hardcoded data' directly and accurately reflects the main change in the changeset: replacing hardcoded user data with dynamic session-based user data.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@apps/web/src/components/nav-user.tsx`:
- Around line 25-43: NavUser currently computes fallback name/email/initials
immediately which causes a flash of placeholders while authClient.useSession()
and useQuery(api.r2.getCurrentUserProfile) are loading; update NavUser to detect
loading (e.g., session.isLoading and profile.isLoading or equivalent flags from
authClient.useSession and useQuery) and either return null or render a small
skeleton component until the essential data (session.data or profile) is
available, and avoid computing derived values like name, email, avatar, and
initials until after loading completes.

Comment thread apps/web/src/components/nav-user.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@apps/web/src/components/nav-user.tsx`:
- Around line 50-55: The current sessionUser/email/name/avatar resolution uses
nullish coalescing (??) which preserves empty strings and can leave blank UI or
an <img src="">; update the logic in the
sessionUser/email/nameFromEmail/name/avatar/initials resolution to normalize
empty strings as missing (use || or explicit checks) so email and name fall back
when values are "" and avatar becomes undefined when empty, and ensure initials
generation uses the normalized name/email values.

Comment thread apps/web/src/components/nav-user.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/web/src/components/nav-user.tsx (1)

65-80: ⚠️ Potential issue | 🟡 Minor

Consider adding error handling for sign-out failures.

If authClient.signOut rejects, the error is silently ignored and the user receives no feedback. While sign-out failures are uncommon, adding basic error handling would improve UX.

🛡️ Suggested fix with error handling
     const handleSignOut = async () => {
+        try {
             await authClient.signOut({
                 fetchOptions: {
                     onSuccess: () => {
                         // The expectAuth: true setting only has affect before the initial authentication.
                         // If a user signs out and signs back in, authenticated queries will likely be called
                         // before authentication is ready, resulting in an error.
                         //
                         // For this reason, the current recommendation is to reload the page on sign out.
                         // For apps that redirect based on authentication, signing out is typically all that's
                         // needed as an unauth redirect will occur after reload.
                         location.reload()
                     },
                 },
             })
+        } catch (error) {
+            console.error("Sign out failed:", error)
+            // Optionally show a toast notification to the user
+        }
     }

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