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

[$500] Chat - When navigating to chat via URL, user has to tap on back arrow twice to return to LHN #40743

Closed
1 of 6 tasks
kavimuru opened this issue Apr 23, 2024 · 31 comments
Closed
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@kavimuru
Copy link

kavimuru commented Apr 23, 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.64-0
Reproducible in staging?: y
Reproducible in production?: n
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4501393
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause internal team
Slack conversation:

Action Performed:

  1. Log in to New Expensify
  2. Navigate to any chat and copy its URL
  3. Return to LHN and navigate to the chat via URL
  4. Tap on back arrow

Expected Result:

User should redirected back to the LHN.

Actual Result:

User remains in the chat, has to tap on back arrow once again to return to the LHN.
Also reproducible when logging in via conversation direct URL.

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

Bug6457935_1713817481164.Record_2024-04-22-22-07-59.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01178464ec2ad2a33e
  • Upwork Job ID: 1782696560950165504
  • Last Price Increase: 2024-04-23
  • Automatic offers:
    • eh2077 | Reviewer | 0
    • nkdengineer | Contributor | 0
@kavimuru kavimuru added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Apr 23, 2024
Copy link

melvin-bot bot commented Apr 23, 2024

Triggered auto assignment to @robertjchen (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

Copy link

melvin-bot bot commented Apr 23, 2024

Triggered auto assignment to @alexpensify (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.

@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Apr 23, 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.

@kavimuru
Copy link
Author

@alexpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors.

@kavimuru
Copy link
Author

We think this bug might be related to #vip-vsb

@mountiny mountiny added the External Added to denote the issue can be worked on by a contributor label Apr 23, 2024
@melvin-bot melvin-bot bot changed the title Chat - When navigating to chat via URL, user has to tap on back arrow twice to return to LHN [$250] Chat - When navigating to chat via URL, user has to tap on back arrow twice to return to LHN Apr 23, 2024
Copy link

melvin-bot bot commented Apr 23, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01178464ec2ad2a33e

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 23, 2024
Copy link

melvin-bot bot commented Apr 23, 2024

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

@mountiny
Copy link
Contributor

We are getting close to deploying, I am going to demote this issue because:

  • only related to deeplinking to report in narrow view which is rare flow for a user in itself
  • it seems to only be relevant to mWeb
  • while annoying ux its not blocking the user from using the app
  • its one off as once they are in the lhn and use the app it will work properly

@mountiny mountiny added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Apr 23, 2024
@mountiny mountiny changed the title [$250] Chat - When navigating to chat via URL, user has to tap on back arrow twice to return to LHN [$500] Chat - When navigating to chat via URL, user has to tap on back arrow twice to return to LHN Apr 23, 2024
Copy link

melvin-bot bot commented Apr 23, 2024

Upwork job price has been updated to $500

@nkdengineer
Copy link
Contributor

nkdengineer commented Apr 24, 2024

Proposal

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

User remains in the chat, has to tap on back arrow once again to return to the LHN.
Also reproducible when logging in via conversation direct URL.

What is the root cause of that problem?

When we open a report by deep link, we will navigate to the report here and it will call linkTo function.

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

Let see this condition here. We're comparing the params object of topmostCentralPaneRoute and action.payload.params?. It's true when we open the report by deep link because topmostCentralPaneRoute has another param is OpenOnAdminRoom that is initialized here

Screenshot 2024-04-24 at 15 20 41

const areParamsDifferent = !shallowCompare(topmostCentralPaneRoute?.params, action.payload.params?.params);

That makes we move to this case and then another report screen is opened because the action.type is push here.

action.type = CONST.NAVIGATION.ACTION_TYPE.PUSH;

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

We should only compare the reportID param as we did in the past instead of comparing the value of params field and we can change this variable name to areReportIDParamsDifferent

const areReportIDParamsDifferent = getTopmostReportId(rootState) !== getTopmostReportId(stateFromPath);

or

const areReportIDParamsDifferent = topmostCentralPaneRoute?.params?.reportID !== action.payload.params?.params?.reportID;

const areParamsDifferent = !shallowCompare(topmostCentralPaneRoute?.params, action.payload.params?.params);

What alternative solutions did you explore? (Optional)

Or we can set initialParams as undefined if openOnAdminRoom is not "true" instead of always adding openOnAdminRoom param here.

initialParams={openOnAdminRoom === 'true' ? {openOnAdminRoom: true} : undefined}

initialParams={{openOnAdminRoom: openOnAdminRoom === 'true' || undefined}}

@nkdengineer
Copy link
Contributor

Updated proposal to add alternative solution.

@eh2077
Copy link
Contributor

eh2077 commented Apr 24, 2024

@nkdengineer Thanks for your proposal!

I agree with your RCA but I have concerns about your main solution - the shallowCompare function may also compare other properties of params like filter. I think the alternative solution you proposed fixes the root cause. Although this issue is uncovered by a recent new feature, the root cause has been there for a while.

That said, I think we can go with @nkdengineer 's proposal.

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Apr 24, 2024

Current assignee @robertjchen is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@abzokhattab
Copy link
Contributor

abzokhattab commented Apr 24, 2024

Proposal

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

Reports are opening twice when accessed via deep-linking by logged-in users or when the report is public.

What is the root cause of that problem?

When a user opens a report via deep-link, the openReportFromDeepLink function is called. This function includes InteractionManager.runAfterInteractions, which is designed for scenarios where an unauthenticated user accesses a private report using deep linking (as mentioned in this comment). In such cases, the user is directed to the sign-in page and then redirected to the report (here).

However, this setup does not account for situations where the user is already signed in or the report is public. In these cases, the user won't be redirected to the sign-in page, and the report will be opened so the InteractionManager.runAfterInteractions navigates again to the report (here), leading to the report being opened twice.

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

To address this issue, we should first check if the report is already open before initiating another navigation to the same report. We can achieve this by utilizing the Navigation.getTopmostReportId here and check if its equal to the current reportID

       const topmostReportId = Navigation.getTopmostReportId();
                if (topmostReportId === reportID) {
                    return;
                }

@abzokhattab
Copy link
Contributor

abzokhattab commented Apr 24, 2024

Hi @eh2077, I would appreciate your feedback on my proposal. I believe we should not navigate to the report from the beginning if it is already open.

@eh2077
Copy link
Contributor

eh2077 commented Apr 24, 2024

@abzokhattab At the first glance, I'm not convinced your RCA and I have concerns about your solution - will it just avoid opening RHP screens? I could be wrong and I'll take a deeper look later. Sorry, I'll be offline in following hours.

@abzokhattab
Copy link
Contributor

I'm not convinced your RCA

i will clarify it more. thanks

will it just avoid opening RHP screens?

The part inside the InteractionManager.runAfterInteractions is intended for scenarios where an unauthenticated user accesses a private report using deeplinking (as mentioned in this comment). in this case, the user will be directed to the sign-in page and then be redirected to the report afterward

However, this code does not account for situations where the user is already signed in or the report is public, in those cases the user won't be redirected to the sign-in page and the report will be already opened causing unnecessary navigation and thus opening the report twice.

Does that answer your question? please let me know

@nkdengineer
Copy link
Contributor

Just a note here

The solution here #40743 (comment) will cause the regression if we open the sub page of report i.e. report detail page by deep link.

Actually, in linkTo function, we had the logic to replace or add a new screen when we navigate to a page that why this bug doesn't happen in the past with navigation logic in openReportFromDeeplink function . So we should fix the current wrong logic in this function.

@eh2077
Copy link
Contributor

eh2077 commented Apr 25, 2024

@abzokhattab Thanks for your comment. I partially agreed with your RCA and I tested your solution. It fixes the issue and also avoids my concerns about opening RHP screens - the reportID is empty string "" and topmostReportId is undefined when opening a RHP like report details page. But I still think it's not the best way to fix this issue in method openReportFromDeeplink.

@eh2077
Copy link
Contributor

eh2077 commented Apr 25, 2024

@nkdengineer Thanks for sharing your thoughts!

Actually, in linkTo function, we had the logic to replace or add a new screen when we navigate to a page that why this bug doesn't happen in the past with navigation logic in openReportFromDeeplink function . So we should fix the current wrong logic in this function.

Yes, I agreed with you. This issue is ideal to be fixed in the linkTo function. Just want to extend discussion about your solutions, can we fix this issue by improving the shallowCompare method? For example, let it omit parameter key with undefined value. Maybe this can be discussed in PR.

@eh2077
Copy link
Contributor

eh2077 commented Apr 29, 2024

According to the discussions above^, I tend to stick to the original review decision #40743 (comment)

@robertjchen All yours.

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Apr 29, 2024

Current assignee @robertjchen is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@robertjchen
Copy link
Contributor

Appreciate the proposals and discussions here! 🙇 After reviewing, I think we will go with @nkdengineer 's proposal

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

melvin-bot bot commented Apr 29, 2024

📣 @eh2077 🎉 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 Apr 29, 2024

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

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Apr 30, 2024
@alexpensify
Copy link
Contributor

Weekly Update: Waiting for this one to go to Production

@alexpensify
Copy link
Contributor

Waiting for automation here

@alexpensify
Copy link
Contributor

@eh2077 - can you please confirm if there is any more action here? It looks like the automation didn't kick in, and I believe that the 7-day mark is today. I need to move forward with the payment process, but I want to double-check. Thanks!

@alexpensify
Copy link
Contributor

@nkdengineer - can you update me if there is any other action here? Thanks!

@eh2077
Copy link
Contributor

eh2077 commented May 14, 2024

Checklist

cc @alexpensify

@alexpensify
Copy link
Contributor

alexpensify commented May 15, 2024

Payouts due: 2024-05-13 - delayed due to automation failure

Upwork job is here. This was treated as a High and is the reason for the payment amount. I've closed the job and paid everyone via Upwork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
No open projects
Archived in project
Development

No branches or pull requests

7 participants