Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOLD for payment 2024-01-11] [$500] Settings - Invalid contact method revisits not here page #33001

Closed
3 of 6 tasks
kbecciv opened this issue Dec 13, 2023 · 36 comments
Closed
3 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@kbecciv
Copy link

kbecciv commented Dec 13, 2023

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: 1.4.12.0
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Open the app
  2. Open invalid contact method details URL eg: https://staging.new.expensify.com/settings/profile/contact-methods/invalid@invalid.com/details
  3. Reload on Hmm its not here page
  4. Click on Go back to contacts page and observe that it again opens Hmm its not here page

Expected Result:

App should not display Hmm its not here page again on click of 'Go back to contacts page'

Actual Result:

App displays Hmm its not here page again on click of 'Go back to contacts page' after reload on any invalid email details page

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6312076_1702492319032.windows_chrome_-_invalid_contact_twice_back_issue.mp4
Bug6312076_1702492318874.mWeb_-_invalid_contact_twice_back_issue.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~019a0d0ed69e19112a
  • Upwork Job ID: 1735011585536487424
  • Last Price Increase: 2023-12-13
  • Automatic offers:
    • s77rt | Contributor | 28065543
    • dukenv0307 | Contributor | 28065544
Issue OwnerCurrent Issue Owner: @conorpendergrast
@kbecciv kbecciv added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 13, 2023
@melvin-bot melvin-bot bot changed the title Settings - Invalid contact method revisits not here page [$500] Settings - Invalid contact method revisits not here page Dec 13, 2023
Copy link

melvin-bot bot commented Dec 13, 2023

Triggered auto assignment to @conorpendergrast (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

Copy link

melvin-bot bot commented Dec 13, 2023

Job added to Upwork: https://www.upwork.com/jobs/~019a0d0ed69e19112a

Copy link

melvin-bot bot commented Dec 13, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 13, 2023
Copy link

melvin-bot bot commented Dec 13, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @Santhosh-Sellavel (External)

@Berndy
Copy link

Berndy commented Dec 13, 2023

I can't reproduce this issue on Linux/Chrome neither in staging, nor in dev

@kbecciv
Copy link
Author

kbecciv commented Dec 13, 2023

Able to reproduce on Windows/Chrome

Recording.5698.mp4

@FitseTLT
Copy link
Contributor

FitseTLT commented Dec 13, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Invalid contact method revisits not here page on navigating back

What is the root cause of that problem?

The root cause of the problem is this line of code

Navigation.navigate(route, CONST.NAVIGATION.ACTION_TYPE.PUSH);

that was added in this pr to solve a deep linking issue on logout for Android.
So when we manually navigate to a link openReportFromDeepLink is called and inside it we run this line of code after interaction via InteractionManager.runAfterInteractions.
Navigation.navigate(route, CONST.NAVIGATION.ACTION_TYPE.PUSH);

So this line of code will push an unnecessary additional route (RightModalNavigator) to navigation state adding unnecessary RightModalNavigator route. So when navigating back it will navigate back to the other unnecessarily added RightModalNavigator route added which in this case is not found page.

What changes do you think we should make in order to solve the problem?

We just need to add a condition here

Navigation.navigate(route, CONST.NAVIGATION.ACTION_TYPE.PUSH);

to check that it is native b/c we only need it to run for native as I explained to fix deep linking problem linked to this pr.
so change it to

if (!willBlurTextInputOnTapOutside) {
                    Navigation.navigate(route, CONST.NAVIGATION.ACTION_TYPE.PUSH);
                }

POC:

2023-12-13.22-36-13.mp4

What alternative solutions did you explore? (Optional)

@dukenv0307
Copy link
Contributor

dukenv0307 commented Dec 14, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

App displays Hmm its not here page again on click of 'Go back to contacts page' after reload on any invalid email details page

What is the root cause of that problem?

When the app is initially loaded, we'll navigate to the initial route here, this is to make sure deeplinking while logged out on various platforms work as expected.

We already have logic here to make sure we don't push that route if the that route is currently the active route. That's exactly so that issues like this don't happen.

However, the logic to check if a route is active here, has a bug.

The getActiveRoute() uses react-navigation built-in getPathFromState method, which will split the path by / and use encodeURIComponent on the route parts (see here for reference), to make sure we operate on the route safely, thus the @ in the /settings/profile/contact-methods/invalid@invalid.com/details route will be in it's encoded format.

Meanwhile the routePath will have the @ as is.

So even if the routes are the same, due to different encoding, they will become not equal, leading to this issue.

What changes do you think we should make in order to solve the problem?

We should make sure to URI-decode the getActiveRoute() properly here. Calling decodeURIComponent on the getActiveRoute should work, in this way we're making the encoding the same by making sure both are URI decoded before comparison

function isActiveRoute(routePath: Route): boolean {
    // We remove First forward slash from the URL before matching
    return decodeURIComponent(getActiveRoute()).substring(1) === routePath;
}

What alternative solutions did you explore? (Optional)

Encoding the routePath properly here, similar to how getActiveRoute is encoded.

We can use the same logic that react-navigation uses on it's getPathFromState method, a simplified version of it is:

function isActiveRoute(routePath: Route): boolean {
    const encodedRoutePath = routePath.split('/').map(encodeURIComponent).join('/');
    // We remove First forward slash from the URL before matching
    return getActiveRoute().substring(1) === encodedRoutePath;
}

We can consider handling all cases as the react-navigation encoding logic itself, but the simplified version above should be enough to fix this issue.

An alternative suggested here is we can use the currentRoute.path in getActiveRoute instead of the current complex logic we have. I've tested with many related issues (that relate to changes to getActiveRoute over time) and it works fine and doesn't cause regressions. So we can go with this as well but will need to test carefully during PR review.

@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented Dec 14, 2023

Requested for help here @s77rt volunteered.

@s77rt please take over this thanks!

cc: @conorpendergrast

@Santhosh-Sellavel Santhosh-Sellavel removed their assignment Dec 14, 2023
@s77rt
Copy link
Contributor

s77rt commented Dec 14, 2023

Taking this as C+

@s77rt
Copy link
Contributor

s77rt commented Dec 16, 2023

@FitseTLT Thanks for the proposal. Your RCA is not correct. You found a cause but not the root cause.

@s77rt
Copy link
Contributor

s77rt commented Dec 16, 2023

@dukenv0307 Thanks for the proposal. Your RCA is correct. However the solution feels a little workaround-ish given that the bug seems to be in react-navigation's getPathFromState. I have been investigating this for a bit and I think we can just use currentRoute.path in getActiveRoute. That's how it was initially done but got changed years ago by #4382 to fix #4280. Can you please test whether we can go with that approach?

cc @mananjadhav in case you remember any specific case not to use currentRoute.path

@FitseTLT
Copy link
Contributor

@s77rt please give a look to this issue too. It has got no @ char in the url but this pr of fixing the deeplinking on logout is causing other cases too, I really recommend to disable the pushing for non native platforms as in my Proposal to prevent future bugs.

@s77rt
Copy link
Contributor

s77rt commented Dec 16, 2023

@FitseTLT It's important that we fix the root cause of the identified problem.

@melvin-bot melvin-bot bot added the Overdue label Dec 16, 2023
Copy link

melvin-bot bot commented Dec 18, 2023

@conorpendergrast Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@dukenv0307
Copy link
Contributor

However the solution feels a little workaround-ish given that the bug seems to be in react-navigation's getPathFromState

@s77rt I don't think the behavior of getPathFromState is a bug, it is just the expected safe encoded format that it returns. Just that if we do the comparison, we need to make sure they are of the same decoded/encoded format.

I think we can just use currentRoute.path in getActiveRoute

@s77rt This is a viable option as well, I've tested with many related issues (that relate to changes to getActiveRoute over time) and it works fine and doesn't cause regressions.

I've updated my proposal to cover that in alternative solutions. If we go with this, I'll make sure to test all flows where we use getActiveRoute to make sure verything is fine.

cc @mananjadhav in case you remember any specific case not to use currentRoute.path

I believe this case is outdated and not present in the current app.

Copy link

melvin-bot bot commented Dec 18, 2023

@conorpendergrast Whoops! This issue is 2 days overdue. Let's get this updated quick!

@s77rt
Copy link
Contributor

s77rt commented Dec 18, 2023

@dukenv0307 Let's go the the currentRoute.path approach.

🎀 👀 🎀 C+ reviewed
Link to proposal

Copy link

melvin-bot bot commented Dec 18, 2023

Triggered auto assignment to @dangrous, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot removed the Overdue label Dec 18, 2023
@conorpendergrast
Copy link
Contributor

Nope! Thankfully they are effectively equivalent from a compensation perspective. I've edited Melvin's comments to make it easy for Future Conor.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Dec 22, 2023
@dukenv0307
Copy link
Contributor

@s77rt this PR is ready for review

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jan 4, 2024
@melvin-bot melvin-bot bot changed the title [$500] Settings - Invalid contact method revisits not here page [HOLD for payment 2024-01-11] [$500] Settings - Invalid contact method revisits not here page Jan 4, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jan 4, 2024
Copy link

melvin-bot bot commented Jan 4, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Jan 4, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.21-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-01-11. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Jan 4, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@s77rt] The PR that introduced the bug has been identified. Link to the PR:
  • [@s77rt] 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:
  • [@s77rt] A discussion in #expensify-bugs 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:
  • [@s77rt] Determine if we should create a regression test for this bug.
  • [@s77rt] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@conorpendergrast] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@s77rt
Copy link
Contributor

s77rt commented Jan 7, 2024


Regression Test Proposal

  1. Open an invalid contact method details URL eg: https://staging.new.expensify.com/settings/profile/contact-methods/invalid@invalid.com/details
  2. Refresh the page
  3. Press go back
  4. Verify you are taken back to the Contact methods page (https://staging.new.expensify.com/settings/profile/contact-methods)

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jan 11, 2024
Copy link

melvin-bot bot commented Jan 11, 2024

Issue is ready for payment but no BZ is assigned. @twisterdotcom you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks!

@twisterdotcom
Copy link
Contributor

but no BZ is assigned

?? @conorpendergrast are you not BZ anymore?

@conorpendergrast
Copy link
Contributor

conorpendergrast commented Jan 11, 2024 via email

@twisterdotcom twisterdotcom removed their assignment Jan 11, 2024
@conorpendergrast
Copy link
Contributor

Payouts due:

Upwork job is here.

@conorpendergrast
Copy link
Contributor

Regression test request created here: https://github.com/Expensify/Expensify/issues/359845

All done, thanks everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

9 participants