feat(clerk-js): Reuse SignIn/SignUp instances#7803
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 134f781 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 |
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
📝 WalkthroughWalkthroughThis change modifies how the Client class processes SignIn and SignUp instances when handling JSON responses. Previously, new SignIn and SignUp objects were unconditionally created during fromJSON. Now, the logic checks if incoming data has matching IDs to existing instances. If IDs match, existing instances are updated via the new 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Description
This PR updates the Client JSON parsing logic to reuse existing
SignInandSignUpinstances when the incoming IDs match the current instance. This results in a stable referential identity forclient.signInandclient.signUpwhen possible. Previously, we were creating new instances ofSignIn/SignUpon every request: one from the mutation HTTP request response, and another from the client piggybacking response. This caused two update events to be emitted, each with different instances of the class.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
Summary by CodeRabbit