-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(clerk-js,types): Reuse existing sign-up if available #4720
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 6c06ff6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 23 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 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
bf3117f
to
b046af0
Compare
b046af0
to
f026587
Compare
f026587
to
a13c8a4
Compare
.changeset/purple-foxes-develop.md
Outdated
'@clerk/types': minor | ||
--- | ||
|
||
Introduced an `upsert` method to the `SignUp` resource, which reuses the existing sign-up attempt ID if it exists. This was an obvious oversight in the ticket flow, so `SignUpStart` has been updated to use this instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a changelog entry that is read by our users, so we don't include context that is internal to us. I would go with a more straight-forward approach like:
Introduced an `upsert` method to the `SignUp` resource, which reuses the existing sign-up attempt ID if it exists. This was an obvious oversight in the ticket flow, so `SignUpStart` has been updated to use this instead. | |
Fix ticket flow on `<SignUp />` component, where in some rare cases the initial ticket/context is lost. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 Also, you can mention that an upsert
function is introduced on the SignUp
resource, because it can be used by custom flow implementations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm reconsidering this and I would go for this changeset with minor
changes and this text:
Introduced an `upsert` method to the `SignUp` resource, which reuses the existing sign-up attempt ID if it exists. This was an obvious oversight in the ticket flow, so `SignUpStart` has been updated to use this instead. | |
Introduced an `upsert` method to the `SignUp` resource, which reuses the existing sign-up attempt ID if it exists. |
And then I would add another changeset with patch
changes and this text:
Introduced an `upsert` method to the `SignUp` resource, which reuses the existing sign-up attempt ID if it exists. This was an obvious oversight in the ticket flow, so `SignUpStart` has been updated to use this instead. | |
Fix ticket flow on `<SignUp />` component, where in some rare cases the initial ticket/context is lost. |
So we will have 2 different entries on our changelog!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep that makes sense @anagstef! Thanks for the suggestions – updated.
a13c8a4
to
6c06ff6
Compare
Hey @kostaspt - 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/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact |
Description
Currently, when a user lands on the sign-up component with a ticket, it sends a request to the Clerk API and starts a new sign-up attempt. If the process requires a password, it will start another new sign-up attempt on submit, losing the original context.
The issue occurs mainly when the server responds with a
422
error because of e.g. a pwned password. If the user then switches to an OAuth strategy, the initial sign-up attempt should be reused with the same context instead of starting over and potentially losing data.This PR fixes the issue by adding an
upsert
method to theSignUp
resource. This method reuses the existing sign-up attempt ID if one already exists. While this change could have been made directly in place, adding this new method seems to me like a cleaner approach. No strong opinions here though to revert to that.Checklist
pnpm test
runs as expected.pnpm build
runs as expected.Type of change