Skip to content

Commit 8dc70eb

Browse files
committed
fix(clerk-react): Prevent prop mutation in UserButton and OrganizationSwitcher (#7316)
1 parent 5a4f2b5 commit 8dc70eb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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)