fix(clerk-react): Re-render <UserButton /> when <UserButton /> props change#5069
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: 530c4c6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
<UserButton /> when <UserButton /> props change<UserButton /> when <UserButton /> props change
e49d43c to
b415b79
Compare
|
!snapshot |
|
Hey @nikospapcom - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/astro@2.1.18-snapshot.v20250203110826 --save-exact
npm i @clerk/backend@1.23.10-snapshot.v20250203110826 --save-exact
npm i @clerk/chrome-extension@2.2.4-snapshot.v20250203110826 --save-exact
npm i @clerk/clerk-js@5.50.2-snapshot.v20250203110826 --save-exact
npm i @clerk/elements@0.22.18-snapshot.v20250203110826 --save-exact
npm i @clerk/clerk-expo@2.7.2-snapshot.v20250203110826 --save-exact
npm i @clerk/expo-passkeys@0.1.17-snapshot.v20250203110826 --save-exact
npm i @clerk/express@1.3.45-snapshot.v20250203110826 --save-exact
npm i @clerk/fastify@2.1.18-snapshot.v20250203110826 --save-exact
npm i @clerk/nextjs@6.10.5-snapshot.v20250203110826 --save-exact
npm i @clerk/nuxt@1.0.14-snapshot.v20250203110826 --save-exact
npm i @clerk/clerk-react@5.22.9-snapshot.v20250203110826 --save-exact
npm i @clerk/react-router@1.0.4-snapshot.v20250203110826 --save-exact
npm i @clerk/remix@4.4.20-snapshot.v20250203110826 --save-exact
npm i @clerk/shared@2.20.17-snapshot.v20250203110826 --save-exact
npm i @clerk/tanstack-start@0.9.1-snapshot.v20250203110826 --save-exact
npm i @clerk/testing@1.4.18-snapshot.v20250203110826 --save-exact
npm i @clerk/ui@0.3.19-snapshot.v20250203110826 --save-exact
npm i @clerk/vue@1.1.9-snapshot.v20250203110826 --save-exact |
<UserButton /> when <UserButton /> props change<UserButton /> when <UserButton /> props change
|
@nikospapcom can you add e2e tests that show case the behaviour ? |
|
Do you think it'll be confusing that this only works in |
35e4dbc to
ef37969
Compare
| const prevProps = without(_prevProps.props, 'customPages', 'customMenuItems', 'children'); | ||
| const newProps = without(this.props.props, 'customPages', 'customMenuItems', 'children'); | ||
| // and the implementation of customPages relies on props getting new references | ||
| const prevProps = without(_prevProps.props, 'customPages', 'children'); |
There was a problem hiding this comment.
❓ Have we checked if this causes infinite re-renders?
There was a problem hiding this comment.
@octoper yes I checked different scenarios and I didn't saw any re-render in <UserButton />, <UserProfile /> or <OrganizationProfile />
There was a problem hiding this comment.
Hey @aldenquimby could you open an issue with a minimal reproduction ?
There was a problem hiding this comment.
Minimal repro here: https://github.com/aldenquimby/clerk-bug-demo/blob/main/src/app/page.tsx
I have an open support ticket. Want me to create a github issue separately?
What do you mean this only works in |
0120183 to
530c4c6
Compare

Description
In this pr we re-render the
<UserButton />component when the props are changinge.g.
Before this change the following example didn't work, the label was always
Chat is OFFNow the
<UserButton />appropriateScreen.Recording.2025-02-03.at.11.54.28.AM.mov
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change