From 8f747f0cb9f424c9da6921b80e2c1192db75e9f9 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Fri, 2 May 2025 15:39:25 -0500 Subject: [PATCH] Use an effect silly goose --- .../EmailDialog/screens/Manage2FA/index.tsx | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/components/dialogs/EmailDialog/screens/Manage2FA/index.tsx b/src/components/dialogs/EmailDialog/screens/Manage2FA/index.tsx index 32e60f3451..427a42b1fd 100644 --- a/src/components/dialogs/EmailDialog/screens/Manage2FA/index.tsx +++ b/src/components/dialogs/EmailDialog/screens/Manage2FA/index.tsx @@ -1,4 +1,4 @@ -import {useState} from 'react' +import {useEffect, useState} from 'react' import {Trans} from '@lingui/macro' import {useAccountEmailState} from '#/components/dialogs/EmailDialog/data/useAccountEmailState' @@ -15,23 +15,24 @@ export function Manage2FA({showScreen}: ScreenProps) { 'enable' | 'disable' | null >(null) - if (!isEmailVerified) { - showScreen({ - id: ScreenID.Verify, - instructions: [ - - You need to verify your email address before you can enable email 2FA. - , - ], - onVerify: () => { - showScreen({ - id: ScreenID.Manage2FA, - }) - }, - }) - - return null - } + useEffect(() => { + if (!isEmailVerified) { + showScreen({ + id: ScreenID.Verify, + instructions: [ + + You need to verify your email address before you can enable email + 2FA. + , + ], + onVerify: () => { + showScreen({ + id: ScreenID.Manage2FA, + }) + }, + }) + } + }, [isEmailVerified, showScreen]) /* * Wacky state handling so that once 2FA settings change, we don't show the