Skip to content

fix(clerk-js): Fix Smart captcha on Sign Up ticket flow#3351

Merged
anagstef merged 2 commits intomainfrom
stefanos/core-2261-fix-ticket-flow-on-smart-captcha
May 9, 2024
Merged

fix(clerk-js): Fix Smart captcha on Sign Up ticket flow#3351
anagstef merged 2 commits intomainfrom
stefanos/core-2261-fix-ticket-flow-on-smart-captcha

Conversation

@anagstef
Copy link
Copy Markdown
Member

@anagstef anagstef commented May 9, 2024

Description

This PR fixes the logic determining if the captcha should fallback to 'Invisible' if the element for the 'Smart' captcha is not found in the DOM. The widget is now selected and rendered synchronously.

Explanation:

Previously the order of the events was the following:

  1. Determine if clerk-js should use the Smart or the Invisible Captcha widget.
  2. Download the CF Turnstile script.
  3. Render the Captcha.

The 2nd step above runs asynchronously and sometimes loading states can remove the #clerk-captcha element from the DOM.

After this change, we move the 2nd step to be done first and synchronously decide the widget and render it (step 1 and 3).

The addition of the captcha element on the loading card may solve our current issue. However, the change described above is a better practice for avoiding future issues.

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:

@anagstef anagstef self-assigned this May 9, 2024
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 9, 2024

🦋 Changeset detected

Latest commit: 95db5ef

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 Patch
@clerk/chrome-extension Patch
@clerk/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

@anagstef anagstef requested review from brkalow and octoper May 9, 2024 12:03
Comment thread packages/clerk-js/src/utils/captcha.ts
@anagstef anagstef requested a review from panteliselef May 9, 2024 12:38
@anagstef anagstef merged commit 9968287 into main May 9, 2024
@anagstef anagstef deleted the stefanos/core-2261-fix-ticket-flow-on-smart-captcha branch May 9, 2024 13:41
@clerk-cookie clerk-cookie mentioned this pull request May 9, 2024
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.

3 participants