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 2023-08-28] [HOLD] [$1000] Web - Clicking on the browser back button takes user from chat page to assign task page #23796

Closed
1 of 6 tasks
kbecciv opened this issue Jul 28, 2023 · 37 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 External Added to denote the issue can be worked on by a contributor

Comments

@kbecciv
Copy link

kbecciv commented Jul 28, 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!


Action Performed:

  1. Open a chat
  2. Click on the plus icon
  3. Click on assign task
  4. Give a title and click next
  5. Confirm the task
  6. From the chat screen click the browser back button

Expected Result:

App should not open the assign task side panel

Actual Result:

App takes user to the assign task screen

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.47-2
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
Notes/Photos/Videos: Any additional supporting documentation

Expensify/Expensify Issue URL:
Issue reported by: @Nathan-Mulugeta
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1690536196870419

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01dd04525ab1095d86
  • Upwork Job ID: 1685016837327048704
  • 2023-07-28
  • Automatic offers:
    • daordonez11 | Contributor | 25816261
    • Nathan-Mulugeta | Reporter | 25816263
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 28, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 28, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 28, 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

@daordonez11
Copy link
Contributor

daordonez11 commented Jul 28, 2023

Proposal

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

Pressing the back button sends to task detail instead of parent report

What is the root cause of that problem?

The dismissModal method in Nagivation.js is using the type REPLACE hence in this special case the parent is replaced with the child so going back does not send to the parent report.

if (targetReportID && targetReportID !== getTopmostReportId(rootState)) {
const state = getStateFromPath(ROUTES.getReportRoute(targetReportID));
const action = getActionFromState(state, linkingConfig.config);
action.type = 'REPLACE';
navigationRef.current.dispatch(action);

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

There is 2 ways of solving it:

  1. I removed the line and normal navigate type is working as expected. Tested in 4 different modals and was working fine.
  2. Use REPLACE when the targetReport is not a child/thread/task of the topmost report. In pseudocode something like:
if(!targetReportID.isChild(getTopmostReportId(rootState)))
{
    action.type = 'REPLACE';
}

Video of solution working:

WithoutReplace.webm

What alternative solutions did you explore? (Optional)

If the action is executed correctly remove previous steps from navigation stack but seems too complex code for something so simple. Something like: Clean steps, navigate to parent, navigate to child.

@mountiny mountiny self-assigned this Jul 28, 2023
@mountiny mountiny added the External Added to denote the issue can be worked on by a contributor label Jul 28, 2023
@melvin-bot melvin-bot bot changed the title Web - Clicking on the browser back button takes user from chat page to assign task page [$1000] Web - Clicking on the browser back button takes user from chat page to assign task page Jul 28, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 28, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01dd04525ab1095d86

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

melvin-bot bot commented Jul 28, 2023

Current assignee @michaelhaxhiu is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jul 28, 2023

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

@mountiny
Copy link
Contributor

Stepping in since its related to navigation

@daordonez11 I think your proposal looks good, but I would go with the option 2. I think we needed the replace there for some other reasons

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 28, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 28, 2023

📣 @eVoloshchak Please request via NewDot manual requests for the Reviewer role ($1000)

@melvin-bot
Copy link

melvin-bot bot commented Jul 28, 2023

📣 @daordonez11 🎉 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
Copy link

melvin-bot bot commented Jul 28, 2023

📣 @Nathan-Mulugeta 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@mountiny
Copy link
Contributor

@adamgrzybowski @WoLewicki do you remember why we had the replace there? I though it was for this exact reason so I am confused that the dismis modal does not work here

@daordonez11
Copy link
Contributor

Got it @mountiny will test the cases! There are 33 usages of dismissModal so probably step 2 is the best way to go, will check if there is any util to validate if it is a child of the report and will test deeply the scenarios. If any of you guys remember the origin of why replace is there would be even better to narrow the validation, specially @WoLewicki I think the first appearance of it is in the commit: d2b8e2 feat: first look on RHP Navigation created by Wojciech.

@melvin-bot melvin-bot bot added the Overdue label Jul 31, 2023
@mountiny
Copy link
Contributor

@daordonez11 Can you please raise a PR? Thank you 🙇

@melvin-bot melvin-bot bot removed the Overdue label Jul 31, 2023
@WoLewicki
Copy link
Contributor

Hmm this topic consists of two parts.

First is the react-navigation state. Here in all those RHP flows such as Request money or Assign task, we want the RHP to disappear after ending the flow and also we want to navigate to the new report immediately after it too. Since RHP is at at the root of the navigation stack, and new report is also there, we just replace the RHP with new report, that's why this code is there and should work correctly (the RHP disappears from navigation tree and new report appears).

Second thing is browser history. All those flows worked with browser buttons as long as they were a single url. It was done with the steps concept, where we navigated between the parts of the RHP flow with simple animations, but we did not change the url in different steps. I created this solution when those flows looked like this. It was just fine then since when calling replace action from react-navigation, we also call replace in browser stack, and since those flows were a single url, we just replaced the last url with the new one, making the back button lead to the previous report.

It changed when those flows started to be different urls. While the react-navigation state still works correctly, the browser history "remembers" all the previous urls, so we just replace the last page of those flows, and clicking back button leads us to the previous page of the flow.

We already found a solution to drop all the entries of history associated with the nested stacks when they are dropped in the react-navigation's browser API integration and @adamgrzybowski should post a PR with it soon. While it will work in our case, we are unsure if it is the behavior most users of react-navigation library would expect, since browser history just follows the urls as the source of truth, so it might be tricky to have it merged upstream imo.

Is it clear enough? Or should I explain something better?

Another thing is that I am not sure why simply navigating in such case works correctly. @daordonez11 could you check if RHP really disappears from the navigation stack if you do not drop it explicitly? Or am I missing something?

@mountiny
Copy link
Contributor

You are right, I have missed that this flow got refactored since then, great explanation, thank you very much

@daordonez11
Copy link
Contributor

Thanks for the detailed explanation! @WoLewicki ita clear why it worked and why it's failing in this case! Let me implement a log to check the status after navigating. To be clear it works because usually dismissing the modal sends back to the same report in that case navigating or replacing does the same! Navigate works because it finds the report in the stack and goes back, and replace just sends directly. Let me do some tests. @mountiny didn't raise PR because was waiting for some context to build the validation, also couldn't find an existing util to validate if one report is parent of the other.

@WoLewicki
Copy link
Contributor

Navigate works because it finds the report in the stack and goes back, and replace just sends directly.

I am afraid we cannot go with such solution since it can drop many reports on the way and we agreed that we always want to push new ones, not navigate back to the old ones after going to them again.

@daordonez11
Copy link
Contributor

Noted thanks @WoLewicki then will make sure Navigate is only used if it is a child report and will validate status of the stack then! Thanks for the help. Also if any of you know a current util that does this would be awesome if not I can build it.

@michaelhaxhiu
Copy link
Contributor

Note: I'm preparing to go OOO for ~2 weeks, but rather than re-assigning this to another BZ, I'm going to keep it assigned. If this sees quick progress while I'm away, please feel free to remove my assignment and re-apply the Bug label to assign a new BZ.

@mountiny mountiny added Monthly KSv2 and removed Reviewing Has a PR in review Weekly KSv2 labels Aug 6, 2023
@mountiny
Copy link
Contributor

mountiny commented Aug 6, 2023

This is on HOLD for react navigation fix so that can take long, making it monthly

@adamgrzybowski
Copy link
Contributor

Hey, this should be fixed by this PR

@mountiny
Copy link
Contributor

@michaelhaxhiu could you please confirm this issue is resolved in staging? If yes, then we can close it

@Nathan-Mulugeta
Copy link

Nathan-Mulugeta commented Aug 17, 2023

Payment has not been processed yet though. Am I not eligible for reporting bonus?

@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 2023

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Monthly KSv2 labels Aug 21, 2023
@melvin-bot melvin-bot bot changed the title [HOLD] [$1000] Web - Clicking on the browser back button takes user from chat page to assign task page [HOLD for payment 2023-08-28] [HOLD] [$1000] Web - Clicking on the browser back button takes user from chat page to assign task page Aug 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.55-8 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 2023-08-28. 🎊

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:

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 2023

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:

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

@michaelhaxhiu
Copy link
Contributor

The bug is resolved!

I paid the bug reporter just now @Nathan-Mulugeta

Special shout out to @daordonez11 for his preliminary efforts in resolving this, it's much appreciated and hope to see you involved in more jobs in the future. 🙏

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
No open projects
Development

No branches or pull requests

9 participants