Skip to content

Conversation

@dstaley
Copy link
Member

@dstaley dstaley commented Feb 9, 2026

Description

This PR updates the Client JSON parsing logic to reuse existing SignIn and SignUp instances when the incoming IDs match the current instance. This results in a stable referential identity for client.signIn and client.signUp when possible. Previously, we were creating new instances of SignIn/SignUp on 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 test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • Improvements
    • Session instances (SignIn and SignUp) are now preserved and updated when receiving data with matching identifiers, rather than being replaced.

@vercel
Copy link

vercel bot commented Feb 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Feb 9, 2026 3:58pm

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Feb 9, 2026

🦋 Changeset detected

Latest commit: 134f781

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@clerk/clerk-js Minor
@clerk/chrome-extension Patch
@clerk/expo Patch

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 9, 2026

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7803

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@7803

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@7803

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@7803

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@7803

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7803

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@7803

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@7803

@clerk/express

npm i https://pkg.pr.new/@clerk/express@7803

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@7803

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@7803

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@7803

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@7803

@clerk/react

npm i https://pkg.pr.new/@clerk/react@7803

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@7803

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@7803

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@7803

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@7803

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@7803

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@7803

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@7803

commit: 134f781

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

📝 Walkthrough

Walkthrough

This 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 __internal_updateFromJSON method; if IDs differ, new instances are created. The __internal_updateFromJSON method is added to both SignIn and SignUp classes as an internal update path. Tests verify both behaviors: instance reuse when IDs match and replacement when IDs differ.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: reusing SignIn/SignUp instances instead of recreating them, which is the primary focus of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant