Open vincdargento opened 1 week ago
Triggered auto assignment to @MitchExpensify (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
Job added to Upwork: https://www.upwork.com/jobs/~021886927951828663823
Triggered auto assignment to Contributor-plus team member for initial proposal review - @s77rt (External
)
🚨 Edited by proposal-police: This proposal was edited at 2025-02-05 21:42:30 UTC.
Fails to enter the contact details page.
When entering the contact details page, the effect below resets the code to unsent state.
It runs an Onyx merge command.
loginList
is undefined
while a merge is pending. After the merge completes, the value becomes valid again.
The effect below sees this change from undefined to valid as the contact method just getting verified, so it navigates the page back to the contact list.
Only reset the code sent state if the contact method hasn’t been verified yet.
useEffect(() => {
if (loginData?.validatedDate) {
return;
}
resetContactMethodValidateCodeSentState(contactMethod);
}, [contactMethod, loginData?.validatedDate]);
N/A
To prevent the undefined value during the merge, pass {allowStaleData: true}
to useOnyx.
const [loginList, loginListResult] = useOnyx(ONYXKEYS.LOGIN_LIST, {allowStaleData: true});
We have implemented a logic to navigate back to the previous screen, which can be found here: https://github.com/Expensify/App/blob/adc61ce54171f0e18892b8eb5cc41e1e4c40e898/src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.tsx#L160
This navigation occurs when a specific condition is not met: https://github.com/Expensify/App/blob/adc61ce54171f0e18892b8eb5cc41e1e4c40e898/src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.tsx#L154
In this bug, when tapping on the main email or secondary email, the app navigates to the ContactMethodDetailsPage
but immediately navigates back. This happens because prevValidatedDate
is undefined
at the time of navigation. The reason for this is that loginData?.validatedDate
is undefined
initially while the Onyx data is still loading. As a result, the condition !loginData?.validatedDate
evaluates to false, and the navigation logic is triggered.
We can update the condition here:
to the following::
if (prevValidatedDate || prevValidatedDate === undefined || !loginData?.validatedDate || !loginData) {
In the updated condition, I added prevValidatedDate === undefined
to address the issue. The purpose of this useEffect is to navigate to the methods page upon successful magic code verification. The validatedDate
property determines the status of the magic code verification.
There is a fact that, before validation, validatedDate
is an empty string (''), and it only gets a non-empty value after successful validation. And that prevValidatedDate
can be undefined
during the initial load. By adding prevValidatedDate === undefined
to the condition, we ensure the logic works correctly by excluding the case where validatedDate
is undefined
, effectively fixing the bug.
NA
@QichenZhu Thanks for the proposal. Your RCA is correct however the solution does not address the root cause. We should avoid updating that onyx key.
@truph01 Thanks for the proposal. Your RCA is not correct.
This happens because prevValidatedDate is undefined at the time of navigation
This is not true
https://github.com/user-attachments/assets/3fc0f6b5-c4c5-4b9f-a9de-edd4e0192c88
FWIW, this is a regression from https://github.com/Expensify/App/issues/55405. If we can alter the approved solution there or find another solution that would be probably easier/better.
@QichenZhu Thanks for the proposal. Your RCA is correct however the solution does not address the root cause. We should avoid updating that onyx key.
@s77rt Thanks for your advice! I’ve updated the main solution and moved the previous solution to the alternative section.
@QichenZhu Thanks for the update. I think that solution may work but I was thinking of something a little different that is to reset the code sent state on the clean up effect. Can you check if we can go with that instead?
@s77rt Thanks for the feedback! Yeah, it would be better if we could do it in the cleanup phase. But the problem is that cleanup code isn’t always guaranteed to run, for example, when you don’t exit the page gracefully.
@QichenZhu Good point! Can you double check that your solution works well with accounts that are not verified too?
@s77rt Tested on iOS, and it works for unverified accounts.
https://github.com/user-attachments/assets/2a50f9a3-c157-452f-b9a0-85ba0bf463b7
@QichenZhu Can you check that after verifying the account we get navigated back correctly?
@s77rt Yes, it navigates back correctly.
https://github.com/user-attachments/assets/b45af20b-e648-49f3-ab75-6689cede0530
@QichenZhu Thank you! The proposal looks good to me.
🎀 👀 🎀 C+ reviewed Link to.proposal
Triggered auto assignment to @MarioExpensify, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Very nice and detailed proposal @QichenZhu, let's move forward. Thanks @s77rt!
📣 @QichenZhu 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑💻 Keep in mind: Code of Conduct | Contributing 📖
Reviewing
label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 9.0.96-1 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2025-02-19. :confetti_ball:
For reference, here are some details about the assignees on this issue:
@s77rt @MitchExpensify @s77rt The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
[X] [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: https://github.com/Expensify/App/pull/55498#discussion_r1957115527
[X] [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: n/a
[X] [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Bug requires regression test: Yes
[ ] [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Do we agree 👍 or 👎
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: v9.0.94-1 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes, reproducible on both If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Email or phone of affected tester (no customers): applausetester+ck22425@applause.expensifail.com Issue reported by: Applause Internal Team Device used: iPhone 16/iOS 18 App Component: User Settings
Action Performed:
Expected Result:
Actual Result:
Nothing happens on tapping the main email & secondary contact method in contact methods page
Note: On ND Standalone app - When logging with new gmail account, a page to enter magic code appears to verify the account. After verifying account, tapping on main contact method does not respond
Workaround:
Unknown
Platforms:
Screenshots/Videos
https://github.com/user-attachments/assets/7dc3f13b-8f59-4d85-8282-3881dbfb0bf5
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @MitchExpensify