javascript icon indicating copy to clipboard operation
javascript copied to clipboard

Auth object not updating after Leaving Organization (via OrganizationSwitcher)

Open zammitjohn opened this issue 1 year ago • 0 comments

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:

  1. Use the auth() helper in a Next.js server component to get the Auth object.
  2. Leave (or delete) an organization using the OrganizationSwitcher.
  3. Observe that the Auth object does not change.
  4. Reload the page.
  5. 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

zammitjohn avatar Sep 27 '24 07:09 zammitjohn