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-07-10] [HOLD for payment 2024-07-02] Thread - App crashes after rejoining thread and opening thread header #44196

Closed
3 of 6 tasks
lanitochka17 opened this issue Jun 22, 2024 · 22 comments · Fixed by #44279
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Jun 22, 2024

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


Version Number: 9.0.1-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: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to any chat
  3. Send a message and also send a reply in thread
  4. In thread, click 3-dot menu > Leave
  5. Go to the thread again
  6. Click Join
  7. Immediately click on the chat header after rejoining the thread
  8. Wait for the crash

Expected Result:

App will not crash

Actual Result:

App crashes after rejoining thread and opening thread header

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

Bug6521356_1719047084692.crash_2.mp4

logs (2).txt

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @bfitzexpensify
@lanitochka17 lanitochka17 added DeployBlockerCash This issue or pull request should block deployment DeployBlocker Indicates it should block deploying the API labels Jun 22, 2024
Copy link

melvin-bot bot commented Jun 22, 2024

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

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.

@lanitochka17
Copy link
Author

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

@lanitochka17
Copy link
Author

We think that this bug might be related to #vip-vsp

@huult
Copy link
Contributor

huult commented Jun 22, 2024

Proposal

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

App crashes

What is the root cause of that problem?

This issue occurred because sortedAllReportActions is undefined, and we are checking the condition sortedAllReportActions.length. Since sortedAllReportActions is undefined, there are pending merge operations for the key during the first connection, as shown in the image below:

Screenshot 2024-06-22 at 22 39 28 Screenshot 2024-06-22 at 22 39 47

To fix this issue, we need to validate if sortedAllReportActions is undefined before checking its length. We should use a default value in destructuring to ensure sortedAllReportActions is always defined and avoid extra undefined checks. Get sortedAllReportActions at.

// src/pages/ReportDetailsPage.tsx#L83
- const [sortedAllReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID ?? ''}`, {
+ const [sortedAllReportActions = []] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID ?? ''}`, {
        canEvict: false,
        selector: (allReportActions: OnyxEntry<OnyxTypes.ReportActions>) => ReportActionsUtils.getSortedReportActionsForDisplay(allReportActions, true),
    });

Note:
This PR handled the case where useOnyx returns undefined.

POC
Screen.Recording.2024-06-22.at.23.40.27.mov

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

What alternative solutions did you explore? (Optional)

@mountiny
Copy link
Contributor

Asked @fabioh8010 to look into this as he has been working on the useOnyx changes

@mountiny mountiny removed the DeployBlocker Indicates it should block deploying the API label Jun 24, 2024
@iwiznia
Copy link
Contributor

iwiznia commented Jun 24, 2024

@fabioh8010 any update here?

Also, why didn't ts catch this earlier? Isn't this type of error exactly the ones TS should be catching before they are merged?

@mountiny
Copy link
Contributor

Here is the thread btw

@fabioh8010
Copy link
Contributor

fabioh8010 commented Jun 24, 2024

@iwiznia @mountiny My investigations so far:

  • I was able to reproduce on Staging, and on main only if I enable Staging server.
  • Yes TS is catching and actually showing that sortedAllReportActions is ReportAction[] because we defined a selector and we are always returning an an array inside it. From TS perspective everything is correct.
  • Yet sortedAllReportActions is still being undefined in this particular situation that shouldn't be possible, I'm still investigating why it's happening (now it will be easier because I was able to reproduce on main)

@fabioh8010
Copy link
Contributor

Update: The problem is inside useOnyx.. looking for a fix.

Copy link

melvin-bot bot commented Jun 24, 2024

⚠️ 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.

@mountiny mountiny removed the DeployBlockerCash This issue or pull request should block deployment label Jun 24, 2024
@mountiny mountiny added the Bug Something is broken. Auto assigns a BugZero manager. label Jun 24, 2024
@mountiny mountiny reopened this Jun 24, 2024
Copy link

melvin-bot bot commented Jun 24, 2024

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

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jun 24, 2024
@mountiny
Copy link
Contributor

PR merged and being CPed, assigned @situchan for future payment

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Jun 25, 2024
@melvin-bot melvin-bot bot changed the title Thread - App crashes after rejoining thread and opening thread header [HOLD for payment 2024-07-02] Thread - App crashes after rejoining thread and opening thread header Jun 25, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 25, 2024
Copy link

melvin-bot bot commented Jun 25, 2024

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

Copy link

melvin-bot bot commented Jun 25, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.1-19 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-07-02. 🎊

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

  • @situchan requires payment (Needs manual offer from BZ)

Copy link

melvin-bot bot commented Jun 25, 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:

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

@bfitzexpensify
Copy link
Contributor

Payment summary:

@situchan due $250 for PR review to be paid via manual request

@situchan
Copy link
Contributor

situchan commented Jul 2, 2024

@bfitzexpensify I am still using upwork

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Jul 3, 2024
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2024-07-02] Thread - App crashes after rejoining thread and opening thread header [HOLD for payment 2024-07-10] [HOLD for payment 2024-07-02] Thread - App crashes after rejoining thread and opening thread header Jul 3, 2024
Copy link

melvin-bot bot commented Jul 3, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.3-7 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-07-10. 🎊

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

  • @situchan requires payment (Needs manual offer from BZ)

Copy link

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

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

@situchan
Copy link
Contributor

@bfitzexpensify I am still using upwork

kind bump ^

@bfitzexpensify
Copy link
Contributor

Apologies @situchan!

Offer sent via Upwork.

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. Engineering Weekly KSv2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants