clerk/javascript

Auth object not updating after Leaving Organization (via OrganizationSwitcher)

Opened this issue · 0 comments

Preliminary Checks

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