fix: prevent turnstile during prerender
All checks were successful
Tests / Backend - Tests skipped: 8, passed: 74
Backend Coverage #### Project Overview No changes detected, that affect the code coverage. * Line Coverage: 78.38% (551/703) * Lines of Code: 703 #### Quality Gates Summary No active quality gates.
Tests / Frontend - Lint, Tests et Build passed: 83
Frontend Coverage #### Project Overview No changes detected, that affect the code coverage. * Line Coverage: 80.90% (555/686) * Lines of Code: 686 #### Quality Gates Summary No active quality gates.
THE-TIP-TOP-MULTIBRANCH/pipeline/head This commit looks good

This commit is contained in:
2026-09-20 01:25:06 +00:00
parent 7c1e4cf3e2
commit d56b91479f

View File

@@ -1,5 +1,5 @@
import { useEffect, useRef } from 'react' import { useEffect, useRef } from 'react'
import { TURNSTILE_SITE_KEY } from '../config/captcha' import { CAPTCHA_ENABLED, TURNSTILE_SITE_KEY } from '../config/captcha'
const TURNSTILE_SCRIPT_ID = 'cf-turnstile-script' const TURNSTILE_SCRIPT_ID = 'cf-turnstile-script'
const TURNSTILE_SCRIPT_URL = const TURNSTILE_SCRIPT_URL =
@@ -10,7 +10,9 @@ export default function Captcha({ onToken }) {
const widgetIdRef = useRef(null) const widgetIdRef = useRef(null)
useEffect(() => { useEffect(() => {
if (!TURNSTILE_SITE_KEY || !containerRef.current) return if (!CAPTCHA_ENABLED || !TURNSTILE_SITE_KEY || !containerRef.current) {
return
}
let cancelled = false let cancelled = false
@@ -108,7 +110,9 @@ export default function Captcha({ onToken }) {
} }
}, [onToken]) }, [onToken])
if (!TURNSTILE_SITE_KEY) return null if (!CAPTCHA_ENABLED || !TURNSTILE_SITE_KEY) {
return null
}
return ( return (
<div <div