Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-signup-future-sso-transfer-stale-ref.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@clerk/clerk-js": patch
---

Fix `signUp.update()` sending a PATCH request to `/client/sign_ups` instead of `/client/sign_ups/{id}` after an SSO sign-in transitions to a sign-up flow (e.g. when legal acceptance is required). The `SignUpFuture` reference held by hooks is now preserved across the transition and reflects the correct sign-up id.
6 changes: 5 additions & 1 deletion packages/clerk-js/src/core/resources/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ export class Client extends BaseResource implements ClientResource {
this.id = data.id;
this.sessions = (data.sessions || []).map(s => new Session(s));

if (data.sign_up && this.signUp instanceof SignUp && this.signUp.id === data.sign_up.id) {
if (data.sign_up && this.signUp instanceof SignUp && (this.signUp.id === data.sign_up.id || !this.signUp.id)) {
// Update in-place when ids match OR when the existing signUp has no id yet
// (e.g. an SSO sign-in that transitions to a sign-up flow). Reusing the same
// SignUp instance preserves any SignUpFuture references held by hooks so they
// remain valid and reflect the correct id after the transition.
this.signUp.__internal_updateFromJSON(data.sign_up);
} else {
this.signUp = new SignUp(data.sign_up);
Expand Down