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-11-29] [$250] mWeb - Inbox- When creating WS via FAB and using device back button, rest of chats disappear #51658

Closed
1 of 8 tasks
lanitochka17 opened this issue Oct 29, 2024 · 28 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

@lanitochka17
Copy link

lanitochka17 commented Oct 29, 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: 9.0.55-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5141100&group_by=cases:section_id&group_order=asc&group_id=229067
Issue reported by: Applause - Internal Team

Action Performed:

  1. Open the staging.new.expensify.com website
  2. Sign in with new account
  3. Complete the onboarding process
  4. Tap on the FAB and select "New Workspace"
  5. Once redirected to workspace details page, use the device back button to return to inbox
  6. Verify that all the chats, including the new workspace chat, are displayed in inbox

Expected Result:

When the user creates a new workspace via FAB and returns to inbox using device back button, all the chats should be visible

Actual Result:

When creating a new workspace via FAB, and returning to inbox using device back button, the rest of the chats disappear and only the workspace chat is visible until navigating to a different category and returning

Workaround:

Unknown

Platforms:

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

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6649332_1730206763889.WS_FAB.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021856428632364438612
  • Upwork Job ID: 1856428632364438612
  • Last Price Increase: 2024-11-12
  • Automatic offers:
    • brunovjk | Reviewer | 104913598
Issue OwnerCurrent Issue Owner: @abekkala
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 29, 2024
Copy link

melvin-bot bot commented Oct 29, 2024

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

@lanitochka17
Copy link
Author

@abekkala 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

@bernhardoj
Copy link
Contributor

Proposal

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

After create a new workspace from FAB and go back, the LHN only shows 1 chat.

What is the root cause of that problem?

The LHN actually has all the chats, but they are all overlapping each other. Normally, each item has a translateY value.
image

But when the issue happens, all the translate are 0. It's handled by flashlist.
https://github.com/Shopify/flash-list/blob/f6723c4ad7a8ba84f0c9d4b2b636f4073c1f9410/src/FlashList.tsx#L511
https://github.com/Shopify/flash-list/blob/f6723c4ad7a8ba84f0c9d4b2b636f4073c1f9410/src/native/config/PlatformHelper.web.ts#L11-L17

The values (x & y) are coming from parentProps. FlashList uses recyclerlistview which the parentProps value comes from. The x & y value is from the recyclerlistview layout manager which holds each item rect.
https://github.com/Flipkart/recyclerlistview/blob/678c3cde10499787387e7cd79ee9ef358d04426f/src/core/RecyclerListView.tsx#L688-L700

When an item is updated, it will update the layout manager with the new item size and then trigger a re-render of the list, only if it's still mounted (tracked by _isMounted variable).
https://github.com/Flipkart/recyclerlistview/blob/678c3cde10499787387e7cd79ee9ef358d04426f/src/core/RecyclerListView.tsx#L735-L741
https://github.com/Flipkart/recyclerlistview/blob/678c3cde10499787387e7cd79ee9ef358d04426f/src/core/RecyclerListView.tsx#L559-L564

In our case, when we create the new workspace from FAB, there are a few things happened:

  1. We are navigated to the workspace detail page. This also changes the bottom tab navigator screen from Home (LHN) to Settings.
  2. A new optimistic expense chat is added, triggering the items update
  3. However, after the bottom tab screen is changed to Settings, the size of each item is always 0. That's because any bottom tab screen that is not focused has a display: none applied to it, just like stack navigator
  4. 0 is saved as the item size to the layout manager
  5. The FlashList list is somehow unmounted which causes RecyclerListView to be unmounted too, setting _isMounted to false

When going back, the list will render each item with the saved size first, 0, so all x and y are 0. Then, each item will trigger a size update to the real size, but when trying to re-render the list, it fails because _isMounted is still false (from step 5) because the constructor isn't triggered again.
https://github.com/Flipkart/recyclerlistview/blob/678c3cde10499787387e7cd79ee9ef358d04426f/src/core/RecyclerListView.tsx#L559-L564

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

Set _isMounted to true in componentDidMount
https://github.com/Flipkart/recyclerlistview/blob/678c3cde10499787387e7cd79ee9ef358d04426f/src/core/RecyclerListView.tsx#L241-L243

What alternative solutions did you explore? (Optional)

I think the reason we check for mounted status is because we debounce the _queueStateRefresh. Instead of using _isMounted to make sure the debounced function isn't triggered when the component is already unmounted, we can cancel the debounce when unmount.

componentWillUnmount() {
    this.refreshRequestDebouncer.cancel();
}

@melvin-bot melvin-bot bot added the Overdue label Oct 31, 2024
Copy link

melvin-bot bot commented Nov 1, 2024

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

Copy link

melvin-bot bot commented Nov 5, 2024

@abekkala Still overdue 6 days?! Let's take care of this!

@abekkala
Copy link
Contributor

abekkala commented Nov 6, 2024

@lanitochka17 is this due to focus mode?

@melvin-bot melvin-bot bot removed the Overdue label Nov 6, 2024
@lanitochka17
Copy link
Author

@abekkala Preferences were set as "Most Recent" at that moment

@melvin-bot melvin-bot bot added the Overdue label Nov 11, 2024
Copy link

melvin-bot bot commented Nov 12, 2024

@abekkala this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

Copy link

melvin-bot bot commented Nov 12, 2024

@abekkala Eep! 4 days overdue now. Issues have feelings too...

@abekkala abekkala added the External Added to denote the issue can be worked on by a contributor label Nov 12, 2024
@melvin-bot melvin-bot bot changed the title mWeb - Inbox- When creating WS via FAB and using device back button, rest of chats disappear [$250] mWeb - Inbox- When creating WS via FAB and using device back button, rest of chats disappear Nov 12, 2024
Copy link

melvin-bot bot commented Nov 12, 2024

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

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

melvin-bot bot commented Nov 12, 2024

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

@brunovjk
Copy link
Contributor

Hey @bernhardoj, Thanks for the proposal, it makes sense to me, I can reproduce the issue across all browser-related platforms (web, desktop, mWeb Android, mWeb iOS). However, I wasn’t able to test your solution—I modified the RecyclerListView.tsx file in the node_modules folder where the recyclerlistview library is stored, but the issue persists. Do you think we need to try something else to test it? Maybe share a test branch? Thanks!

@bernhardoj
Copy link
Contributor

You need to change the node_modules/recyclerlistview/dist/reactnative/core/RecyclerListView.js.

@brunovjk
Copy link
Contributor

Thanks for clarifying, @bernhardoj. Your proposal makes sense to me and tested well in a quick test:

before_change
main.mov
after_change
proposal.mov

However, I’m not 100% sure about potential regressions or side effects. We’ll need to do more thorough testing in the next step. Have you thought about the best way to proceed? How should we implement this change so others can test it properly? Does that make sense? Thanks again!

@bernhardoj
Copy link
Contributor

How should we implement this change so others can test it properly?

Sorry, I don't quite get this one. I don't think there is any difference with other cases of adding patches and upstream PR.

@brunovjk
Copy link
Contributor

Ok, thanks for clarifying :D With that, I think we can proceed with @bernhardoj’s proposal.

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Nov 13, 2024

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

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

melvin-bot bot commented Nov 15, 2024

📣 @brunovjk 🎉 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

@grgia
Copy link
Contributor

grgia commented Nov 15, 2024

Thanks for your proposal @bernhardoj !

@bernhardoj
Copy link
Contributor

PR is ready. Added the upstream PR link on the PR.

cc: @brunovjk

@muttmuure muttmuure moved this to CRITICAL in [#whatsnext] #quality Nov 19, 2024
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Nov 22, 2024
@melvin-bot melvin-bot bot changed the title [$250] mWeb - Inbox- When creating WS via FAB and using device back button, rest of chats disappear [HOLD for payment 2024-11-29] [$250] mWeb - Inbox- When creating WS via FAB and using device back button, rest of chats disappear Nov 22, 2024
Copy link

melvin-bot bot commented Nov 22, 2024

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

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

melvin-bot bot commented Nov 22, 2024

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

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

Copy link

melvin-bot bot commented Nov 22, 2024

@brunovjk @abekkala @brunovjk The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@abekkala
Copy link
Contributor

PAYMENT SUMMARY NOV 29

@bernhardoj
Copy link
Contributor

Requested in ND.

@JmillsExpensify
Copy link

$250 approved for @bernhardoj

@brunovjk
Copy link
Contributor

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

Where bug was reported:

  • 2a. Reported on production
  • 2b. Reported on staging (deploy blocker)
  • 2c. Reported on both staging and production
  • 2d. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other: Applause - Internal Team
  • [Contributor] 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: This bug stems from a third-party dependency (recyclerlistview) and not from a PR authored by contributors to this repository

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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:

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

Regression Test Proposal

  1. Log in with a new user account.
  2. Create a new workspace via the FAB button.
  3. Navigate back to the inbox using the back button (browser/device-specific).
  4. Verify all chats, including the new workspace chat, are displayed in the inbox.
  5. Navigate between tabs and confirm the chat list updates without errors.
  6. Trigger additional list updates (e.g., new chat creation) and validate rendering.

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Nov 29, 2024
@abekkala
Copy link
Contributor

@brunovjk payment sent and contract ended - thank you! 🎉

@github-project-automation github-project-automation bot moved this from CRITICAL to Done in [#whatsnext] #quality Nov 29, 2024
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
Development

No branches or pull requests

6 participants