Skip to content

Populate Next.js UserProfile fields from users/me/meta schema - #83

Merged
brionmario merged 1 commit into
thunder-id:mainfrom
janithjay:fix-nextjs-users-me-meta
Aug 18, 2026
Merged

Populate Next.js UserProfile fields from users/me/meta schema#83
brionmario merged 1 commit into
thunder-id:mainfrom
janithjay:fix-nextjs-users-me-meta

Conversation

@janithjay

Copy link
Copy Markdown
Contributor

Purpose

<UserProfile> component in @thunderid/nextjs didn't receives a userSchema, so it always renders through BaseUserProfile's schema-less fallback path. Raw flattened profile keys were used with generic, startCase derived labels (Ou Id, Family Name, Sub) instead of the schema's configured display names, and no required/regex validation on edit.

Approach

Traced the gap through the full data path and found userSchema was dropped at three separate points, so all three needed fixing together,

  • ThunderIDServerProvider (server/ThunderIDProvider.tsx) calls getUserAction (ID token claims) and getUserProfileAction (getUsersMe), but nothing ever calls getUsersMeMeta. Added ThunderIDNextClient.getUserSchema() and a new server/actions/getUserSchemaAction.ts server action, called alongside the existing two under the same shouldFetchUserProfile gate.

  • The client-side provider (client/contexts/ThunderID/ThunderIDProvider.tsx) had userSchema: null hardcoded in its context value, and never received the schema as a prop in the first place. Added a userSchema prop, synced into state the same way userProfile already is, and passed it into <UserProvider userSchema={userSchema}>. The actual context useUser() reads from, which the hardcoded value never reached regardless.

  • client/components/presentation/UserProfile/UserProfile.tsx only destructured {profile, flattenedProfile, onUpdateProfile, updateProfile} from useUser(), omitting userSchema entirely, and never passed it to <BaseUserProfile>. Even with the schema correctly available upstream, this component would still never have rendered it. Fixed to read and pass userSchema through.

After Fix

image

Related Issues

Related PRs

  • N/A

Checklist

  • Followed the contribution guidelines.
  • Manual test round performed and verified.
  • Documentation provided. (Add links if there are any)
  • Tests provided. (Add links if there are any)
    • Unit Tests
    • Integration Tests
  • Breaking changes. (Fill if applicable)
    • Breaking changes section filled.
    • breaking change label added.

Security checks

  • Followed secure coding standards.
  • Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Important

Review available on request

  • 🔍 Trigger review

Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment @coderabbitai review to review the latest changes. For a full review, comment @coderabbitai full review.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 73aa0224-bc06-4626-89d4-ea7f810a1d4c


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@janithjay
janithjay force-pushed the fix-nextjs-users-me-meta branch from 54a1b17 to 1425c4c Compare August 17, 2026 18:56
@janithjay
janithjay marked this pull request as ready for review August 17, 2026 18:56
Copilot AI lite review requested due to automatic review settings August 17, 2026 18:56

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Signed-off-by: janithjay <janithjayashan018@gmail.com>
@janithjay
janithjay force-pushed the fix-nextjs-users-me-meta branch from 1425c4c to 45b808f Compare August 18, 2026 05:09
@brionmario
brionmario merged commit 184e280 into thunder-id:main Aug 18, 2026
6 checks passed
@janithjay
janithjay deleted the fix-nextjs-users-me-meta branch August 18, 2026 07:56
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.

UserProfile component doesn't populate fields using schema in Next.js SDK

3 participants