Skip to content

Commit cf66d07

Browse files
fix(clerk-react): Prevent prop mutation in UserButton and OrganizationSwitcher (#7316)
Co-authored-by: Jacek Radko <jacek@clerk.dev>
1 parent f115e56 commit cf66d07

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/hot-ads-relate.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@clerk/clerk-react": patch
3+
---
4+
5+
Fixed an issue where `<APIKeys />` mounted in a custom page caused an application to freeze.

packages/react/src/components/uiComponents.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ const _UserButton = withClerk(
257257
const { customPages, customPagesPortals } = useUserProfileCustomPages(props.children, {
258258
allowForAnyChildren: !!props.__experimental_asProvider,
259259
});
260-
const userProfileProps = Object.assign(props.userProfileProps || {}, { customPages });
260+
const userProfileProps = { ...props.userProfileProps, customPages };
261261
const { customMenuItems, customMenuItemsPortals } = useUserButtonCustomMenuItems(props.children, {
262262
allowForAnyChildren: !!props.__experimental_asProvider,
263263
});
@@ -435,7 +435,7 @@ const _OrganizationSwitcher = withClerk(
435435
const { customPages, customPagesPortals } = useOrganizationProfileCustomPages(props.children, {
436436
allowForAnyChildren: !!props.__experimental_asProvider,
437437
});
438-
const organizationProfileProps = Object.assign(props.organizationProfileProps || {}, { customPages });
438+
const organizationProfileProps = { ...props.organizationProfileProps, customPages };
439439
const sanitizedChildren = useSanitizedChildren(props.children);
440440

441441
const passableProps = {

0 commit comments

Comments
 (0)