Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/four-crabs-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/clerk-js': patch
---

The organizationPreviewSecondaryIdentifier element will no longer be rendered empty inside the organization switcher's list.
6 changes: 4 additions & 2 deletions packages/clerk-js/src/ui/elements/OrganizationPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const OrganizationPreview = (props: OrganizationPreviewProps) => {

const membership = user?.organizationMemberships.find(membership => membership.organization.id === organization.id);
const unlocalizedRoleLabel = options?.find(a => a.value === membership?.role)?.label;
const roleLabel = localizeCustomRole(membership?.role) || unlocalizedRoleLabel;

const mainTextSize =
mainIdentifierVariant || ({ xs: 'subtitle', sm: 'caption', md: 'subtitle', lg: 'h1' } as const)[size];
Expand Down Expand Up @@ -91,12 +92,13 @@ export const OrganizationPreview = (props: OrganizationPreviewProps) => {
>
{organization.name} {badge}
</Text>
{organization.name && (

{roleLabel && (
<Text
elementDescriptor={descriptors.organizationPreviewSecondaryIdentifier}
elementId={descriptors.organizationPreviewSecondaryIdentifier.setId(elementId)}
localizationKey={localizeCustomRole(membership?.role) || unlocalizedRoleLabel}
as='span'
localizationKey={roleLabel}
truncate
/>
)}
Expand Down