Skip to content

Commit dbe59ad

Browse files
alexcarpenterclaude
andcommitted
fix: use Object.assign pattern for composed exports
Export UserProfile and OrganizationProfile as function components with static properties (via Object.assign) instead of plain objects. This matches the existing UserButton pattern and is compatible with React Server Components client references, which support property access on function exports but not on plain object exports. The provider is now the root component itself — consumers write <UserProfile> instead of <UserProfile.Provider>. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7a9bae4 commit dbe59ad

3 files changed

Lines changed: 8 additions & 10 deletions

File tree

packages/ui/src/composed/OrganizationProfile/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ import {
1010
GeneralVerifiedDomains,
1111
} from './sectionWrappers';
1212

13-
export const OrganizationProfile = {
14-
Provider: OrganizationProfileProvider,
13+
export const OrganizationProfile = Object.assign(OrganizationProfileProvider, {
1514
General,
1615
Members,
1716
Billing,
@@ -20,4 +19,4 @@ export const OrganizationProfile = {
2019
GeneralVerifiedDomains,
2120
GeneralLeaveOrganization,
2221
GeneralDeleteOrganization,
23-
};
22+
});

packages/ui/src/composed/UserProfile/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ import {
1818
} from './sectionWrappers';
1919
import { UserProfileProvider } from './UserProfileProvider';
2020

21-
export const UserProfile = {
22-
Provider: UserProfileProvider,
21+
export const UserProfile = Object.assign(UserProfileProvider, {
2322
Account,
2423
Security,
2524
Billing,
@@ -36,4 +35,4 @@ export const UserProfile = {
3635
SecurityMfa,
3736
SecurityActiveDevices,
3837
SecurityDelete,
39-
};
38+
});

playground/composed/src/App.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export function App() {
8787
</div>
8888

8989
{profileType === 'user' && (
90-
<UserProfile.Provider>
90+
<UserProfile>
9191
<TabBar
9292
tabs={['account', 'security', 'billing', 'api-keys']}
9393
active={userTab}
@@ -125,11 +125,11 @@ export function App() {
125125
{userTab === 'api-keys' && <UserProfile.APIKeys />}
126126
</>
127127
)}
128-
</UserProfile.Provider>
128+
</UserProfile>
129129
)}
130130

131131
{profileType === 'organization' && (
132-
<OrganizationProfile.Provider>
132+
<OrganizationProfile>
133133
<TabBar
134134
tabs={['general', 'members', 'billing', 'api-keys']}
135135
active={orgTab}
@@ -157,7 +157,7 @@ export function App() {
157157
{orgTab === 'api-keys' && <OrganizationProfile.APIKeys />}
158158
</>
159159
)}
160-
</OrganizationProfile.Provider>
160+
</OrganizationProfile>
161161
)}
162162
</>
163163
}

0 commit comments

Comments
 (0)