Reverse step order in Add Contact Method flow#77429
Reverse step order in Add Contact Method flow#77429carlosmiceli merged 27 commits intoExpensify:mainfrom
Conversation
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
@suneox I’ve just pushed a few updates to complete the PR. |
Thank for update I'll take a look at this one today |
|
@cretadn22 We have an issue after verifying the magic code on the primary account, the user dismiss the input new email contact method flow and starts over. Even though the magic code verification page is skipped, the ResendValidateCode API is still being called. Please take a look at 1:00–1:25. Expected result: the ResendValidateCode API should not be called CleanShot.2025-12-15.at.23.07.10.mp4 |
|
From the video at Expected resultWhen entering an invalid contact method, an error should be displayed on the input page. Actual resultNo error is shown on the input form, and the user can add multiple emails with the same error to Contact Methods. @carlosmiceli Please let me know if the expected result is correct. |
|
@fedirjh For this bug (#77429 (comment)), the API error should be stored in formState?.errors (in this form it's newContactMethodForm) |
@suneox @cretadn22 I think this is a FE issue, we should show the error message and block navigation if any errors occur. |
|
@suneox @fedirjh Normally, server-side errors in a form should be stored in the form field so that the FormProvider can detect them and display them according to the intended design (we don't need to handle server error manually). App/src/components/Form/FormProvider.tsx Line 141 in edb021d In this case, however, the server error is being saved in a different location by Backend, which prevents it from being shown correctly. I can address this on the FE side by adding an effect to copy the server error to the appropriate place, but this would essentially be a workaround rather than a root fix. Do you agree with proceeding with this approach? |
|
@cretadn22 Could you try to capture the error at
|
|
@suneox yes, the server error is saved in Onyx. I only try to display it |
For this issue, I think we should navigate back to NewContactMethodConfirmMagicCodePage instead of showing the error message on NewContactMethodPage. What do you think? |
|
@carlosmiceli We’re currently stuck on an unconsidered edge case and need confirmation on the expected behavior for issue 1: how should we handle an expired magic code? Option 1: Option 2: For Issue 2: cc: @fedirjh @cretadn22 |
|
For issue 1, I think resetting the flow is easiest and less prone to more bugs. For issue 2, don't we reset the modal to the beginning of the flow if we close the modal anyway? I think it's ok not to keep the modal state if it's closed in this flow. |
|
@suneox With that in mind, issue 2 looks fine as expectation. For issue 1, we will need to reset the flow to NewContactMethodConfirmMagicCodePage when the backend returns a “magic code expired” error without displaying an error message. |
@carlosalmonte04 Regarding issue 1, since we don't have reliable information indicating whether the current account validation has expired, what do you think about applying both option 1 and option 2? cc: @cretadn22 @fedirjh |
|
cc @carlosmiceli for above solution ☝️ |
|
@suneox @cretadn22 that seems to cover all cases, right? Sure, let's combine the solutions. |
@suneox @carlosmiceli I just want to double confirm this point. The “Add contact method” flow can fail for multiple reasons, not only because the validation code has expired. Do we want to reset the flow for any error, or only for expired code case? If the intent is to reset the flow only when the validation code is expired, we may need a workaround to reliably detect that scenario from the BE response.
Option 3: Otherwise, what do you think about applying only option 1? And If we require a validation code every time the user starts the flow, the “expired code” case should be much less likely to occur. If it happens we will display the error message in that page (similar to other server error).
|
|
Keeping option 1 and showing an error in this case looks good to me |
…t into NewContactMethodPage for error handling
…avigation logic in NewContactMethodConfirmMagicCodePage
|
@suneox Could you please take another look and review this PR? Thank you |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/carlosmiceli in version: 9.3.0-0 🚀
|
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.3.0-8 🚀
|



Explanation of Change
Fixed Issues
$ #60577
PROPOSAL: #60577 (comment)
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
pixel-9a.mp4
Android: mWeb Chrome
mobile.mp4
iOS: Native
Simulator.Screen.Recording.-.iPhone.16e.-.2025-12-14.at.23.33.58.mp4
iOS: mWeb Safari
Simulator.Screen.Recording.-.iPhone.16e.-.2025-12-14.at.20.33.44.mp4
MacOS: Chrome / Safari
Screen.Recording.2025-12-14.at.19.50.19.mp4