marsidev / react-turnstile

Cloudflare Turnstile integration for React.
https://www.npmjs.com/package/@marsidev/react-turnstile
MIT License
357 stars 20 forks source link

Fix useImperativeHandle not grabbing new window.turnstile #58

Closed Cretezy closed 5 months ago

Cretezy commented 5 months ago

Hi! I found a bug which only seem to be trigger from an odd case in our code. Unfortunately I'm not at the liberty to share an example currently.

useImperativeHandle grabs window.turnstile at the begining, however if Turnstile is loaded after the callback, window.turnstile stays undefined. The fix is to add turnstileLoaded in the dependencies.

vercel[bot] commented 5 months ago

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 Apr 3, 2024 9:00pm