fix(ui): Default OAuthConsent org selection to last active organization#8362
fix(ui): Default OAuthConsent org selection to last active organization#8362wobsoriano merged 1 commit intomainfrom
Conversation
The OAuthConsent org picker now preselects the user's last active organization when it matches a membership, falling back to the first membership otherwise. Users typically want to consent on behalf of the org they were most recently working in, not whichever one the API returned first.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: a0701c4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe changes implement a feature for the Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
wobsoriano
left a comment
There was a problem hiding this comment.
Thanks, Kyle! Should we also set the selected organization as the active one? If yes, I can open a follow-up PR.
Description
The
<OAuthConsent />org picker currently defaults to whichever org the API returns first. This change seeds the default fromclerk.session?.lastActiveOrganizationIdso users consent on behalf of the org they were most recently working in, falling back to the first membership when the last active org is null, doesn't match any membership, or was deleted. Read via the already-in-scopeuseClerk()(no new hook, no re-renders fromuseSession), and the existing render guards keep the no-memberships case unchanged.Added three test cases covering the match, no-match, and null paths, plus a
@clerk/uipatch changeset.Checklist
Type of change