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-09-29] Find a better solution for removing visibilityListeners when changing the visible reports #27502

Closed
2 of 6 tasks
danieldoglas opened this issue Sep 15, 2023 · 16 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

Comments

@danieldoglas
Copy link
Contributor

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


While navigating through the app, we're adding all components to the navigation stack. When using Web or Desktop, both of which show LHN and the ReportPage simultaneously, we never unmount the components from a previous report when navigating to a new one.

That is a problem because all reports have an event listener attached to them related to the app visibility, so every time a user leaves the application and go back to it, we do a OpenReport call. That means that for all reports in the history, we would do one OpenReport call.

We've removed the OpenReport call after discussing it here, but that is not removing the listener, it's just checking inside the listener if we should really call the function.

One possible way to solve this is to have a function related to the FreezeWrapper, that every time we freeze a screen in the stack, it removes the listener, but other solutions might be explored.

Action Performed:

Break down in numbered steps

  • on Desktop, navigate through several reports
  • Minimize the application and open it again
  • Check the network table

Expected Result:

Describe what you think should've happened

  • Only one call to OpenReport was done

Actual Result:

Describe what actually happened

  • Several calls to OpenReport are done

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

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:
Reproducible in staging?:
Reproducible in production?:
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:
Slack conversation:

View all open jobs on GitHub

@danieldoglas danieldoglas added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 15, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 15, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 15, 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

@staszekscp
Copy link
Contributor

Hi! I'll work on this issue :)

@danieldoglas
Copy link
Contributor Author

@mallenexpensify I'll remove you from this one since we don't need to manage contributors for now!

@staszekscp
Copy link
Contributor

staszekscp commented Sep 18, 2023

Proposal

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

Fix removal logic of visibilityListeners on web and desktop.

What is the root cause of that problem?

Currently on web and desktop there is an issue with setting multiple event listeners for report visibility - it is related to the fact that reports were not being unmounted at all, so the cleanup function that was supposed to remove listeners was not called.

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

Move the logic of setting visibilityListeners to a separate useFocusEffect hook that would operate on isFocused logic provided by react-navigation. This way we will make sure that the report that is currently focused is actually sending the correct event - namely it is actually visible.

What alternative solutions did you explore? (Optional)

Attaching the logic to FreezeWrapper, but it would require many more changes in the codebase, and it is not a clean the cleanest solution anyway

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Sep 18, 2023
@adamgrzybowski
Copy link
Contributor

👁️ 👁️

@parasharrajat
Copy link
Member

parasharrajat commented Sep 18, 2023

Note: we found that in some cases multiple openReport calls are made. If these calls are related to one report then we should prevent them and allow only one. #27642 (comment)


It was decided to solve this in a separate issue #27642 (comment) as it requires further analysis and it is different from current issue.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Sep 22, 2023
@melvin-bot melvin-bot bot changed the title Find a better solution for removing visibilityListeners when changing the visible reports [HOLD for payment 2023-09-29] Find a better solution for removing visibilityListeners when changing the visible reports Sep 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 22, 2023

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Sep 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 22, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.72-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 2023-09-29. 🎊

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 Sep 22, 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:

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

@parasharrajat
Copy link
Member

parasharrajat commented Sep 26, 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:

  • [@parasharrajat] The PR that introduced the bug has been identified. Link to the PR: Not a bug. Just a refactor.
  • [@parasharrajat] 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: Not a bug. Just a refactor.
  • [@parasharrajat] 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: N/A.
  • [@parasharrajat] Determine if we should create a regression test for this bug. No
  • [@parasharrajat] 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. Not required

@melvin-bot melvin-bot bot removed the Weekly KSv2 label Sep 29, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

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

@danieldoglas
Copy link
Contributor Author

@mallenexpensify , readding you to the issue since we need to deal with C+ payment in this one!

@melvin-bot melvin-bot bot removed the Overdue label Oct 2, 2023
@mallenexpensify
Copy link
Contributor

mallenexpensify commented Oct 4, 2023

Contributor+: @parasharrajat is due $500 via NewDot

Regression Test isn't needed so closing!

@github-project-automation github-project-automation bot moved this from CRITICAL to Done in [#whatsnext] #quality Oct 4, 2023
@parasharrajat
Copy link
Member

Payment requested as per #27502 (comment)

@JmillsExpensify
Copy link

$500 payment approved for @parasharrajat based on BZ summary.

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
Projects
Development

No branches or pull requests

6 participants