Repository navigation
fix(mosaic): refetch the switcher trigger badge when the callback changes - #11063
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: b4dc9d9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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 |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-biometrics
@clerk/expo-google-signin
@clerk/expo-native-components
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/mosaic
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |


Description
The switcher trigger badge did not update when the
triggerBadgecallback changed. #10456 (released in@clerk/mosaic0.1.14) removed the callback from the badge request'suseMemodeps to stop a flicker, so a new callback for the same kind, id and session never requested the badge again. For example, going from a callback that returnsnullto one that returns a plan left the trigger without a badge.The request is keyed on the callback again. The flicker #10456 fixed came from hiding the badge while any request was pending. The controller now tags each result with the kind, id and session it was fetched for and shows the badge only when they match the current ones:
An inline callback requests the badge again on each render of the parent, but the badge stays mounted. The changeset recommends
useCallback.Two feature tests cover the refetch and the kept badge. The existing inline-callback test now expects the second request and still checks that the badge never unmounts.
Before
The pre-#10456 approach (callback in the deps, badge hidden while pending), Swingset
Switcher→ custom trigger badge, opening and closing three times. The trigger loses its badge and narrows on each open and close:before-open-close.mp4
10× slow motion of the first open and close:
before-open-close-10x-slow.mp4
After
after-open-close.mp4
10× slow motion:
after-open-close-10x-slow.mp4
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change