From 78b9e042d041750269a12c8b06814165cb962d8f Mon Sep 17 00:00:00 2001 From: Captain Jack Sparrow <163903675+sussy-code@users.noreply.github.com> Date: Tue, 4 Jun 2024 19:37:54 +0000 Subject: [PATCH] Update turnstiles and pray --- src/components/overlays/OverlayDisplay.tsx | 5 ++++- src/stores/turnstile/index.tsx | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/overlays/OverlayDisplay.tsx b/src/components/overlays/OverlayDisplay.tsx index c3dd7bae..4ffe93f8 100644 --- a/src/components/overlays/OverlayDisplay.tsx +++ b/src/components/overlays/OverlayDisplay.tsx @@ -20,7 +20,10 @@ export interface OverlayProps { function TurnstileInteractive() { const { t } = useTranslation(); const [show, setShow] = useState(false); - getTurnstile(); + + useEffect(() => { + 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 ddb47ee1..b88e0e09 100644 --- a/src/stores/turnstile/index.tsx +++ b/src/stores/turnstile/index.tsx @@ -101,7 +101,7 @@ export function TurnstileProvider(props: { isInPopout?: boolean; onUpdateShow?: (show: boolean) => void; }) { - const siteKey = conf().TURNSTILE_KEY; + const siteKey = conf().TURNSTILE_KEY?.toString(); const idRef = useRef(null); const setTurnstile = useTurnstileStore((s) => s.setTurnstile); const processToken = useTurnstileStore((s) => s.processToken);