refactor(mfa): extract BiometricsTestToolRow from TestToolMenu#90967
Draft
dariusz-biela wants to merge 3 commits into
Draft
Conversation
OutcomeScreenBase and AuthenticationMethodDescription pulled the full Context module (Provider -> Main -> State -> stateReducer -> config -> scenarios), forming an import cycle that resolved to customConfig(undefined) at module-load and crashed the sortTransactionsPending3DSReview test suite at load. - Extract the two React Context objects + their consumer hooks into leaf files MultifactorAuthenticationStateContext.ts and MultifactorAuthenticationActionsContext.ts (no downstream imports). - Merge State.tsx into Provider.tsx and rename to MultifactorAuthenticationComposedContextProviders.tsx; drop ComposeProviders for direct nesting. - Rename Main.tsx to MultifactorAuthenticationMainContext.tsx. - Point UI primitives at the leaf context files directly so their import graph stops at React + types.
The deny outcome (DeniedTransactionSuccessScreen / failure variants) is rendered inline inside the RHP page, not inside its own navigator. The outcome screen's default close handler calls Navigation.closeRHPFlow(), which is correct for this surface, but useBeforeRemove was re-opening the cancel-confirm modal because allowNavigatingAwayRef was still false when the user tapped "Got it" / header back. Add an optional onClose override to OutcomeScreenBase (forwarded through Success/FailureScreenBase). AuthorizeTransactionPage passes a callback that flips allowNavigatingAwayRef.current = true before closing the RHP, so the unsaved-changes guard does not block the close. The default onClose stays as Navigation.closeRHPFlow() — no behavior change for non-RHP outcome callers.
TestToolMenu was calling useBiometricRegistrationStatus, useSingleExecution, useWaitForNavigation and tracking isMFARevokeLoading unconditionally — even when the user is logged out and the biometrics row is not rendered (it sits inside the existing isAuthenticated guard). The biometrics-specific concerns also bloated the menu and made unrelated reads on every render. Move the biometrics-related JSX, state, and hook calls into a dedicated BiometricsTestToolRow component. The new row keeps the existing trigger path (singleExecution(waitForNavigate(() => Navigation.navigate(BIOMETRICS_TEST)))) unchanged; only the rendering location changes. TestToolMenu now renders <BiometricsTestToolRow /> inside the same isAuthenticated block, so the biometrics hooks run only when the row is actually shown. Tests do not change: all mocks were module-level and continue to apply.
27 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation of Change
TestToolMenuwas callinguseBiometricRegistrationStatus,useSingleExecution,useWaitForNavigationand trackingisMFARevokeLoadingunconditionally — even when the user is logged out and the biometrics row is not rendered (the row sits inside the existingisAuthenticatedguard). The biometrics-specific concerns also bloated the menu and forced unrelated reads on every render.Move the biometrics-related JSX, state, and hook calls into a dedicated
BiometricsTestToolRowcomponent. The new row keeps the existing trigger path (singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.MULTIFACTOR_AUTHENTICATION_BIOMETRICS_TEST)))) unchanged; only the rendering location changes.TestToolMenunow renders<BiometricsTestToolRow />inside the sameisAuthenticatedblock, so the biometrics hooks run only when the row is actually shown.Fixed Issues
$ #81021
PROPOSAL:
Tests
Offline tests
The biometrics row is unchanged in offline behavior — both the Test button (via `waitForNavigate`) and the Revoke button work the same as today.
QA Steps
Same as Tests.
PR Author Checklist
Screenshots/Videos
Android: Native
To be added.
Android: mWeb Chrome
To be added.
iOS: Native
To be added.
iOS: mWeb Safari
To be added.
MacOS: Chrome / Safari
To be added.