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

[C+ Checklist Needs Completion] [$250] Android - Deep link - staging.new.expensify.com/a/hello loads twice when navigate via link #34543

Closed
1 of 6 tasks
lanitochka17 opened this issue Jan 15, 2024 · 61 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Jan 15, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 1.4.25-1
Reproducible in staging?: Y
Reproducible in production?: N
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. Navigate to https://staging.new.expensify.com/a/hello
    while app is open

Expected Result:

Page not found should be displayed

Actual Result:

When navigate to non-existing profile page is loaded twice

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

Bug6343637_1705355949224.az_recorder_20240115_182256.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~012fdfa325d3bd25e5
  • Upwork Job ID: 1747053448950476800
  • Last Price Increase: 2024-05-16
  • Automatic offers:
    • akinwale | Reviewer | 0
    • dukenv0307 | Contributor | 0
Issue OwnerCurrent Issue Owner: @greg-schroeder
@lanitochka17 lanitochka17 added the DeployBlockerCash This issue or pull request should block deployment label Jan 15, 2024
Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

Copy link

melvin-bot bot commented Jan 15, 2024

Triggered auto assignment to @joelbettner (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@mountiny mountiny 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. and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Jan 16, 2024
Copy link

melvin-bot bot commented Jan 16, 2024

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

Copy link

melvin-bot bot commented Jan 16, 2024

Job added to Upwork: https://www.upwork.com/jobs/~012fdfa325d3bd25e5

@melvin-bot melvin-bot bot changed the title Android - Deep link - staging.new.expensify.com/a/hello loads twice when navigate via link [$500] Android - Deep link - staging.new.expensify.com/a/hello loads twice when navigate via link Jan 16, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 16, 2024
Copy link

melvin-bot bot commented Jan 16, 2024

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

@mountiny
Copy link
Contributor

Minor bug/ flow, demoting and marking as external

@mountiny mountiny changed the title [$500] Android - Deep link - staging.new.expensify.com/a/hello loads twice when navigate via link [$250] Android - Deep link - staging.new.expensify.com/a/hello loads twice when navigate via link Jan 16, 2024
Copy link

melvin-bot bot commented Jan 16, 2024

Upwork job price has been updated to $250

@dukenv0307
Copy link
Contributor

dukenv0307 commented Jan 16, 2024

Proposal

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

When navigate to non-existing profile page is loaded twice

What is the root cause of that problem?

When we open deep link in mobile when logged in, there'll be 2 things that trigger a route change:
a. react-navigation itself that will adjust to the passed in route
b. Manual route push here

This causes double route push to the Not Found page, and the user has to press go back twice to get back to the LHN

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

The manual route push in b part is only necessary if the user is not authenticated. If the user is already authenticated, the a part will already handle the navigation.

So we should do the route push in b only if the user is not authenticated at the time of opening the deeplink:

  • Here, add a second param shouldNavigate which will be true by default
function openReportFromDeepLink(url: string, shouldNavigate = true) {
  • Here, early return (not navigate) if shouldNavigate is false
if (!shouldNavigate) {
   return;
}
  • Here, define a isAuthenticatedRef that will store the latest value of isAuthenticated
const isAuthenticatedRef = useRef(false);
isAuthenticatedRef.current = isAuthenticated;

We cannot use isAuthenticated as is because this useEffect doesn't have isAuthenticated in the dependency list, so the isAuthenticated value will be outdated when we try to use it.

  • Here, pass in !isAuthenticatedRef.current as the second param

What alternative solutions did you explore? (Optional)

In addition to the main solution, we can potentially make the solution stricter by only navigating if both isAuthenticatedRef.current is false and the route we want to navigate to is a protected route (not a public route), a.k.a that route we're trying to navigate to is not found in the root navigation at the time of deeplinking

@melvin-bot melvin-bot bot added the Overdue label Jan 18, 2024
@joelbettner
Copy link
Contributor

Given that I've not been asked to review any proposals by @akinwale yet, I'm going to unassign myself from this for focus on other things.

@melvin-bot melvin-bot bot removed the Overdue label Jan 19, 2024
@joelbettner joelbettner removed their assignment Jan 19, 2024
@akinwale
Copy link
Contributor

Given that I've not been asked to review any proposals by @akinwale yet, I'm going to unassign myself from this for focus on other things.

Somehow, I missed the notifications for this earlier. I'll review shortly.

@akinwale
Copy link
Contributor

We can move forward with @dukenv0307's proposal here.

🎀👀🎀 C+ reviewed.

@dukenv0307
Copy link
Contributor

@akinwale @MonilBhavsar Proposal updated to address the latest root cause.

@akinwale
Copy link
Contributor

@akinwale @MonilBhavsar Proposal updated to address the latest root cause.

I think the solution looks solid.

@dukenv0307 The issue happens for non-existent profile pages, but can you also verify that existing profile pages still work as expected?

@MonilBhavsar
Copy link
Contributor

Thanks @dukenv0307!

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label May 21, 2024
Copy link

melvin-bot bot commented May 21, 2024

📣 @akinwale 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented May 21, 2024

📣 @dukenv0307 🎉 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 📖

@dukenv0307
Copy link
Contributor

@dukenv0307 The issue happens for non-existent profile pages, but can you also verify that existing profile pages still work as expected?

@akinwale Yeah I've tested that and it works well too in existing profile pages. I'll open the PR soon 🙏

@greg-schroeder
Copy link
Contributor

Awesome, good progress!

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

@akinwale this PR is ready for preview

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels May 30, 2024
@melvin-bot melvin-bot bot changed the title [$250] Android - Deep link - staging.new.expensify.com/a/hello loads twice when navigate via link [HOLD for payment 2024-06-06] [$250] Android - Deep link - staging.new.expensify.com/a/hello loads twice when navigate via link May 30, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label May 30, 2024
Copy link

melvin-bot bot commented May 30, 2024

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

Copy link

melvin-bot bot commented May 30, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.77-11 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-06-06. 🎊

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

Copy link

melvin-bot bot commented May 30, 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:

  • [@akinwale / @dukenv0307] The PR that introduced the bug has been identified. Link to the PR:
  • [@akinwale / @dukenv0307] 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:
  • [@akinwale / @dukenv0307] 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:
  • [@akinwale / @dukenv0307] Determine if we should create a regression test for this bug.
  • [@akinwale / @dukenv0307] 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.
  • [@greg-schroeder] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@greg-schroeder
Copy link
Contributor

Looks set to go for payment

@greg-schroeder
Copy link
Contributor

Paid! @akinwale can you complete the checklist so we can close this out? Thanks.

@greg-schroeder greg-schroeder changed the title [HOLD for payment 2024-06-06] [$250] Android - Deep link - staging.new.expensify.com/a/hello loads twice when navigate via link [C+ Checklist Needs Completion] [$250] Android - Deep link - staging.new.expensify.com/a/hello loads twice when navigate via link Jun 6, 2024
@akinwale
Copy link
Contributor

akinwale commented Jun 6, 2024

  • [@akinwale] The PR that introduced the bug has been identified. Link to the PR:
  • [@akinwale] 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:
  • [@akinwale] 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:

Not a regression. It's more of an edge-case which wasn't handled.

  • [@akinwale] Determine if we should create a regression test for this bug.
  • [@akinwale] 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.

Regression Test Steps

  1. Launch the Expensify app
  2. Navigate to a non-existent profile URL within the app, e.g. /a/hello while the app is open. If testing using the simulator, navigate to the URL using the command, npx uri-scheme open new-expensify://a/hello --android (--ios for iOS).
  3. Verify that the destination page isn't loaded twice. When navigation back occurs, it should return to the previous screen.

Do we agree 👍 or 👎?

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jun 6, 2024
@greg-schroeder
Copy link
Contributor

Thanks! Filing and closing

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 Engineering External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Archived in project
Development

No branches or pull requests

8 participants