-
Notifications
You must be signed in to change notification settings - Fork 382
fix(clerk-js): Do not switch after-auth screens on org invites revalidation #6191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(clerk-js): Do not switch after-auth screens on org invites revalidation #6191
Conversation
🦋 Changeset detectedLatest commit: 59c5b1f The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
📝 Walkthrough## Walkthrough
This change updates the after-authentication flow in the '@clerk/clerk-js' package to prevent the "create organization" form from appearing after a user accepts an organization invitation. The `ForceOrganizationSelectionTask` component now uses a `useRef` hook named `currentFlow` to track whether the user is in the "create-organization" or "organization-selection" flow. This ref is passed to both the `OrganizationSelectionPage` and `CreateOrganizationPage` components, which update it via a `useEffect` hook to ensure consistent UI rendering. The logic ensures that once the organization selection page is shown, it remains visible even if data changes, avoiding unwanted UI transitions.
## Possibly related PRs
- clerk/javascript#6117: Modifies the organization selection and creation flow in `@clerk/clerk-js`, addressing UI behavior after organization creation to prevent unwanted screen flickering or transitions by controlling component rendering.
## Suggested reviewers
- aeliox
- wobsoriano 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (5)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
7e5ee4d
to
59c5b1f
Compare
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/elements
@clerk/clerk-expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/clerk-react
@clerk/react-router
@clerk/remix
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/themes
@clerk/types
@clerk/upgrade
@clerk/vue
commit: |
Description
This PR introduces a fix to prevent after-auth screens from the "org" task from switching when organization data is revalidated, such as when invitations are accepted.
Once the invitation gets accepted, the component is re-rendered and shows the create organization form. Instead, we want to allow the user to take the invite and then click on it.
Previously:
with.sso.and.org.invite.-.bug.mp4
With bug fix:
CleanShot.2025-06-25.at.12.22.36.mp4
Checklist
pnpm test
runs as expected.pnpm build
runs as expected.Type of change
Summary by CodeRabbit