From 130d4b149b37eb2a88a2f42c83c46c447820ac3c Mon Sep 17 00:00:00 2001 From: danidfra Date: Thu, 10 Oct 2024 17:46:38 -0300 Subject: [PATCH] Add useEffect on showCaptcha --- src/init/soapbox-mount.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/init/soapbox-mount.tsx b/src/init/soapbox-mount.tsx index 49bed38cc..ad187beec 100644 --- a/src/init/soapbox-mount.tsx +++ b/src/init/soapbox-mount.tsx @@ -1,4 +1,4 @@ -import React, { Suspense } from 'react'; +import React, { Suspense, useEffect } from 'react'; import { Toaster } from 'react-hot-toast'; import { BrowserRouter, Switch, Redirect, Route } from 'react-router-dom'; import { CompatRouter } from 'react-router-dom-v5-compat'; @@ -39,9 +39,11 @@ const SoapboxMount = () => { const needsOnboarding = useAppSelector(state => state.onboarding.needsOnboarding); const showOnboarding = account && needsOnboarding; - if (showCaptcha) { - dispatch(openModal('CAPTCHA')); - } + useEffect(() => { + if (showCaptcha) { + dispatch(openModal('CAPTCHA')); + } + }, [showCaptcha]); if (showOnboarding) { dispatch(openModal('ONBOARDING_FLOW'));