Skip to content
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

Prevent injecting script multiple times #72

Merged
merged 5 commits into from
Jun 3, 2024

Conversation

marsidev
Copy link
Owner

@marsidev marsidev commented Jun 3, 2024

This PR intends to fix #70

Previously, when we had multiple widgets in the same page, we injected a Turnstile script per widget. This caused some warnings in the console.

This was fixed by changing the behavior for injecting the script. We were inspired by this other library: Le0Developer/react-turnstile. 🙌

Now we always use a single script.

We also fixed a problem with the cleanup function, also mentioned in the issue.

Copy link

codesandbox bot commented Jun 3, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link

vercel bot commented Jun 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-turnstile ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 3, 2024 8:54pm

@marsidev marsidev marked this pull request as ready for review June 3, 2024 21:00
@marsidev marsidev merged commit eb6eb62 into main Jun 3, 2024
7 checks passed
@marsidev marsidev deleted the fix/scripts-and-multi-widgets branch June 3, 2024 21:00
@VladChernikovCap
Copy link

thank you guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple widgets issue
2 participants