Skip to content

Conversation

@brkalow
Copy link
Member

@brkalow brkalow commented Oct 11, 2024

Description

Fixed a bug in the sign up flow where the sign up form was unable to accept additional requirements when initiated from a ticket.

fixes SDKI-697

Checklist

  • npm test runs as expected.
  • npm run 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:

@changeset-bot
Copy link

changeset-bot bot commented Oct 11, 2024

🦋 Changeset detected

Latest commit: 8d3279e

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

This PR includes changesets to release 1 package
Name Type
@clerk/elements 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

Comment on lines -346 to -347
target: 'Start',
reenter: true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was causing the child machine to be re-created, and subsequently it would move right back to Attempting because of the presence of the ticket. For RESET.STEP specifically, we want to update the formRef of the child machine as this even is fired when the form machine is re-created.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There might be a better spot to put this that makes the intent more explicit. The underlying attempt actor was getting canceled, and subsequently re-created, by the reinitialization of the start machine. Changing this to only updating the form ref (which is what triggers RESET.STEP) solved the re-initialization issue.

Comment on lines +128 to +131
{
guard: and(['hasTicket', 'isMissingRequirements']),
target: 'Pending',
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the sign up attempt is missing requirements, users need to be able to submit the form, so we move to Pending

if (field) {
field.checked = event.field.checked;
field.disabled = event.field.disabled || false;
field.disabled = event.field.disabled ?? field.disabled;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this matters in practice (field shouldn't get updated if disabled), but if this does happen, we want to retain the existing disabled value.

@brkalow brkalow merged commit 7cff9d8 into main Oct 14, 2024
21 checks passed
@brkalow brkalow deleted the brk.fix/progressive-ticket branch October 14, 2024 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants