Skip to content

Commit 1ee8322

Browse files
committed
fix: load turnstile script
1 parent 075f70a commit 1ee8322

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

Diff for: public/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
gtag('config', 'G-8D0MD2S4PK');
3939
</script>
4040
<!-- Cloudflare (turnstile) -->
41-
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js?onload=onAppReady" defer></script>
41+
<script async src="https://challenges.cloudflare.com/turnstile/v0/api.js?onload=onAppReady"></script>
4242

4343

4444
<title>React App</title>

Diff for: src/index.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ const loadTheme = () => {
4949
};
5050

5151
const loadTurnstile = () => {
52+
console.log('loading turnstile');
5253
if (ssrEnabled) return;
5354
(window as any).onAppReady = function () {
55+
console.log('onAppReady');
5456
(window as any).isTurnstileReady = true;
5557
const event = new CustomEvent('isTurnstileReadyChange');
5658
window.dispatchEvent(event);

Diff for: src/server/Html.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ function Html({
8181
async
8282
src="https://www.googletagmanager.com/gtag/js?id=G-8D0MD2S4PK"
8383
></script>
84+
<script>
85+
86+
</script>
8487
<script
8588
dangerouslySetInnerHTML={{
8689
__html: `window.dataLayer = window.dataLayer || [];

0 commit comments

Comments
 (0)