Skip to content

Commit 4db7100

Browse files
authored
fix(ui): Remove Personal Account web3 id (#7531)
1 parent c51027c commit 4db7100

File tree

6 files changed

+50
-4
lines changed

6 files changed

+50
-4
lines changed

.changeset/witty-walls-wave.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@clerk/ui': patch
3+
---
4+
5+
Fix personal account display in `OrganizationSwitcher` and `OrganizationList` to exclude `primaryWeb3Wallet` from user identifiers
6+

packages/ui/src/components/OrganizationList/UserMembershipList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export const PersonalAccountPreview = withCardStateProvider(() => {
8282
return null;
8383
}
8484

85-
const { username, primaryEmailAddress, primaryPhoneNumber, ...userWithoutIdentifiers } = user;
85+
const { primaryEmailAddress, primaryPhoneNumber, primaryWeb3Wallet, username, ...userWithoutIdentifiers } = user;
8686

8787
const handlePersonalClicked = () => {
8888
if (!isLoaded) {

packages/ui/src/components/OrganizationSwitcher/OrganizationSwitcherPopover.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const OrganizationSwitcherPopover = React.forwardRef<HTMLDivElement, Orga
4848
return null;
4949
}
5050

51-
const { username, primaryEmailAddress, primaryPhoneNumber, ...userWithoutIdentifiers } = user;
51+
const { primaryEmailAddress, primaryPhoneNumber, primaryWeb3Wallet, username, ...userWithoutIdentifiers } = user;
5252

5353
if (!isLoaded) {
5454
return null;

packages/ui/src/components/OrganizationSwitcher/OrganizationSwitcherTrigger.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const OrganizationSwitcherTrigger = withAvatarShimmer(
2929
return null;
3030
}
3131

32-
const { username, primaryEmailAddress, primaryPhoneNumber, ...userWithoutIdentifiers } = user;
32+
const { primaryEmailAddress, primaryPhoneNumber, primaryWeb3Wallet, username, ...userWithoutIdentifiers } = user;
3333

3434
return (
3535
<Button

packages/ui/src/components/OrganizationSwitcher/UserMembershipList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const UserMembershipList = (props: UserMembershipListProps) => {
5757
return null;
5858
}
5959

60-
const { username, primaryEmailAddress, primaryPhoneNumber, ...userWithoutIdentifiers } = user;
60+
const { primaryEmailAddress, primaryPhoneNumber, primaryWeb3Wallet, username, ...userWithoutIdentifiers } = user;
6161

6262
const { isLoading, hasNextPage } = userMemberships;
6363

packages/ui/src/components/OrganizationSwitcher/__tests__/OrganizationSwitcher.test.tsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,46 @@ describe('OrganizationSwitcher', () => {
9797
expect(getByText('Personal account')).toBeInTheDocument();
9898
});
9999

100+
it('does not show user identifiers in the personal workspace trigger', async () => {
101+
const { wrapper, props } = await createFixtures(f => {
102+
f.withOrganizations();
103+
f.withUser({
104+
email_addresses: ['[email protected]'],
105+
username: 'testuser',
106+
});
107+
});
108+
109+
props.setProps({ hidePersonal: false });
110+
const { getByText, queryByText } = render(<OrganizationSwitcher />, { wrapper });
111+
expect(getByText('Personal account')).toBeInTheDocument();
112+
expect(queryByText('[email protected]')).not.toBeInTheDocument();
113+
expect(queryByText('testuser')).not.toBeInTheDocument();
114+
});
115+
116+
it('does not show web3 wallet address in the personal workspace trigger', async () => {
117+
const { wrapper, props } = await createFixtures(f => {
118+
f.withOrganizations();
119+
f.withUser({
120+
email_addresses: ['[email protected]'],
121+
primary_web3_wallet_id: 'web3_wallet_123',
122+
web3_wallets: [
123+
{
124+
id: 'web3_wallet_123',
125+
object: 'web3_wallet',
126+
web3_wallet: '0x1234567890abcdef1234567890abcdef12345678',
127+
verification: { status: 'verified', strategy: 'web3_metamask_signature', attempts: 1, expire_at: null },
128+
},
129+
],
130+
});
131+
});
132+
133+
props.setProps({ hidePersonal: false });
134+
const { getByText, queryByText } = render(<OrganizationSwitcher />, { wrapper });
135+
expect(getByText('Personal account')).toBeInTheDocument();
136+
expect(queryByText('0x1234567890abcdef1234567890abcdef12345678')).not.toBeInTheDocument();
137+
expect(queryByText('0x1234')).not.toBeInTheDocument();
138+
});
139+
100140
it('shows "No organization selected" when user has no active organization and hidePersonal is true', async () => {
101141
const { wrapper, props } = await createFixtures(f => {
102142
f.withOrganizations();

0 commit comments

Comments
 (0)