File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
src/components/MultifactorAuthentication/Context Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -437,14 +437,21 @@ function MultifactorAuthenticationContextProvider({children}: MultifactorAuthent
437437 * Sets an error state which triggers navigation to the failure outcome.
438438 */
439439 const cancel = useCallback ( ( ) => {
440- // Set error to trigger failure navigation
440+ // When the app is reopened (e.g. page refresh on web), the MFA context resets to its default state
441+ // and scenario becomes undefined. Without a scenario, the state machine in process() won't run,
442+ // so dispatching SET_ERROR would have no effect. In this case we dismiss the modal directly.
443+ if ( ! state . scenario ) {
444+ Navigation . dismissModal ( ) ;
445+ return ;
446+ }
447+
441448 dispatch ( {
442449 type : 'SET_ERROR' ,
443450 payload : {
444451 reason : CONST . MULTIFACTOR_AUTHENTICATION . REASON . EXPO . CANCELED ,
445452 } ,
446453 } ) ;
447- } , [ dispatch ] ) ;
454+ } , [ dispatch , state . scenario ] ) ;
448455
449456 const contextValue : MultifactorAuthenticationContextValue = useMemo (
450457 ( ) => ( {
You can’t perform that action at this time.
0 commit comments