ghostdevv / svelte-turnstile

A lightweight Svelte component for Cloudflare Turnstile
https://svelte-turnstile.pages.dev/
MIT License
163 stars 10 forks source link

refactor: load turnstile script manually #23

Closed mstachowiak closed 2 months ago

mstachowiak commented 7 months ago

Fixes: #22

Modifying script loading to accommodate the upcoming release of Svelte 5. The on:load event for scripts placed inside <svelte:head> does not fire in Svelte 5 as a result of this bug: https://github.com/sveltejs/svelte/issues/8301

Instead of loading the Cloudfare Turnstile script in <svelte:head>, load the script dynamically during mount. This is functionally equivalent to using <svelte:head> but accommodates an operational load event handler. If Svelte 5 resolves Issue 8301, this is not needed.


This pull request can be reviewed on GitContext.com

timootten commented 2 months ago

Please merge this, thanks :)

ghostdevv commented 2 months ago

Thanks! Sorry for the delay :sweat_smile: