diff --git a/.changeset/yummy-laws-hunt.md b/.changeset/yummy-laws-hunt.md new file mode 100644 index 00000000000..db67bdda057 --- /dev/null +++ b/.changeset/yummy-laws-hunt.md @@ -0,0 +1,5 @@ +--- +'@clerk/clerk-js': patch +--- + +Hide invitation in `OrganizationSwitcher` when user is already an active member of the organization diff --git a/packages/clerk-js/src/ui/components/OrganizationSwitcher/UserInvitationSuggestionList.tsx b/packages/clerk-js/src/ui/components/OrganizationSwitcher/UserInvitationSuggestionList.tsx index dff52ea442f..a6fa3e0f2b7 100644 --- a/packages/clerk-js/src/ui/components/OrganizationSwitcher/UserInvitationSuggestionList.tsx +++ b/packages/clerk-js/src/ui/components/OrganizationSwitcher/UserInvitationSuggestionList.tsx @@ -168,7 +168,10 @@ const InvitationPreview = withCardStateProvider( }; if (status === 'accepted') { - if (acceptedOrganization?.id && activeOrganization?.id === acceptedOrganization.id) { + if ( + invitation.publicOrganizationData.id === activeOrganization?.id || + (acceptedOrganization?.id && activeOrganization?.id === acceptedOrganization.id) + ) { // Hide the Accepted invitation that looks like a membership when the organization is already active return null; }