From 86553c3518d00ef4228806e5a7a5af4b00150471 Mon Sep 17 00:00:00 2001 From: jakub-tldr <78603704+jakub-tldr@users.noreply.github.com> Date: Thu, 23 Oct 2025 23:30:47 +0200 Subject: [PATCH] refresh modal on location change --- .../LocationsList/modals/MFAModal/MFAModal.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pages/client/pages/ClientInstancePage/components/LocationsList/modals/MFAModal/MFAModal.tsx b/src/pages/client/pages/ClientInstancePage/components/LocationsList/modals/MFAModal/MFAModal.tsx index 2307f534..2302090b 100644 --- a/src/pages/client/pages/ClientInstancePage/components/LocationsList/modals/MFAModal/MFAModal.tsx +++ b/src/pages/client/pages/ClientInstancePage/components/LocationsList/modals/MFAModal/MFAModal.tsx @@ -88,10 +88,16 @@ export const MFAModal = () => { setStartResponse(undefined); }; - const resetAuthState = () => { + const resetAuthState = useCallback(() => { setScreen('start'); setStartResponse(undefined); - }; + }, []); + + useEffect(() => { + if (location) { + resetAuthState(); + } + }, [location, resetAuthState]); // selectedMethod: 0 = authenticator app, 1 = email, 2 = OpenID, 3 = MobileApprove const startMFA = useCallback(