javascript
javascript copied to clipboard
Auth object not updating after Leaving Organization (via OrganizationSwitcher)
Preliminary Checks
-
[X] I have reviewed the documentation: https://clerk.com/docs
-
[X] I have searched for existing issues: https://github.com/clerk/javascript/issues
-
[X] I have not already reached out to Clerk support via email or Discord (if you have, no need to open an issue here)
-
[X] This issue is not a question, general help request, or anything other than a bug report directly related to Clerk. Please ask questions in our Discord community: https://clerk.com/discord.
Reproduction
Always
Publishable key
pk_test_YWxpdmUtY2hpcG11bmstOTcuY2xlcmsuYWNjb3VudHMuZGV2JA
Description
Description:
I am using the auth() helper in a Next.js server component to return the Auth object of the currently active user. However, when I leave an organization using the OrganizationSwitcher, the Auth object does not update unless the page is reloaded (refreshed). As a result, the orgId value within the Auth object is not updated.
Steps to Reproduce:
- Use the
auth()helper in a Next.js server component to get the Auth object. - Leave (or delete) an organization using the
OrganizationSwitcher. - Observe that the Auth object does not change.
- Reload the page.
- Observe that the Auth object updates correctly.
Expected Behavior: The Auth object should update immediately after leaving an organization without needing to reload the page.
Actual Behavior: The Auth object remains unchanged until the page is reloaded.
Environment
npmPackages:
@clerk/nextjs: ^5.6.2 => 5.6.2
next: ^14.2.13 => 14.2.13