diff --git a/src/components/overlays/OverlayDisplay.tsx b/src/components/overlays/OverlayDisplay.tsx index b1806989..c3dd7bae 100644 --- a/src/components/overlays/OverlayDisplay.tsx +++ b/src/components/overlays/OverlayDisplay.tsx @@ -9,7 +9,7 @@ import { useInternalOverlayRouter, useRouterAnchorUpdate, } from "@/hooks/useOverlayRouter"; -import { TurnstileProvider } from "@/stores/turnstile"; +import { TurnstileProvider, getTurnstile } from "@/stores/turnstile"; export interface OverlayProps { id: string; @@ -20,6 +20,7 @@ export interface OverlayProps { function TurnstileInteractive() { const { t } = useTranslation(); const [show, setShow] = useState(false); + getTurnstile(); // this may not rerender with different dom structure, must be exactly the same always return ( diff --git a/src/stores/turnstile/index.tsx b/src/stores/turnstile/index.tsx index 7a52c26b..ddb47ee1 100644 --- a/src/stores/turnstile/index.tsx +++ b/src/stores/turnstile/index.tsx @@ -81,6 +81,9 @@ export async function getTurnstileToken() { const turnstile = getTurnstile(); try { // I hate turnstile + if (turnstile.controls.isExpired()) { + turnstile.controls.reset(); + } (window as any).turnstile.execute( document.querySelector(`#${turnstile.id}`), {},