fix(web): show the signed-in user in the sidebar instead of "User" - #391
Open
nbmorgan wants to merge 1 commit into
Open
fix(web): show the signed-in user in the sidebar instead of "User"#391nbmorgan wants to merge 1 commit into
nbmorgan wants to merge 1 commit into
Conversation
The sidebar read the session via NextAuths useSession, which expects a
{ user: { id, email } } shape. But /v1/auth/session is served by the OneCLI
API and returns the profile flat ({ id, email, name }), so session.user was
always undefined and the user rendered as "User" with no email.
Read the session the same way the dashboard layout does — via apiFetch to
/v1/auth/session — and take id/email/name off the response root.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #390.
Problem
The dashboard sidebar always shows the signed-in user as "User" with no email.
Cause
The client auth provider reads the session via NextAuth
useSession(), whichexpects
{ user: { id, email } }. But/v1/auth/sessionis served by theOneCLI API and returns the profile flat (
{ id, email, name, projectId, organizationId }), sosession.userisundefinedand the user is treated asanonymous.
Fix
Read the session the same way the dashboard layout already does — fetch
/v1/auth/sessionviaapiFetchand takeid/email/nameoff the responseroot. No dependency on NextAuth's client session shape.
Reproducible on a vanilla install (log in → the sidebar shows "User"); the fix
is independent of the basePath work in #362 / #380.