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

[$1000] App crashed when revisiting thread from left room #26256

Closed
1 of 6 tasks
izarutskaya opened this issue Aug 29, 2023 · 22 comments
Closed
1 of 6 tasks

[$1000] App crashed when revisiting thread from left room #26256

izarutskaya opened this issue Aug 29, 2023 · 22 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@izarutskaya
Copy link

izarutskaya commented Aug 29, 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. Create a new room
  2. Send a message, create a thread with that message, pin that thread for later use.
  3. Go back to our room and leave it then go back to the previous thread that you pinned.
  4. Notice that app is crashed.

Expected Result:

App shouldn't be crashed

Actual Result:

App crashed when revisiting thread from left room.

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: v1.3.58-3

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

Screen.Recording.2023-08-22.At.17.15.56.mp4
Recording.1369.mp4

Expensify/Expensify Issue URL:

Issue reported by: @hungvu193

Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1692703142297279

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~011ed400862f0d676e
  • Upwork Job ID: 1696683478876925952
  • Last Price Increase: 2023-08-30
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. DeployBlockerCash This issue or pull request should block deployment labels Aug 29, 2023
@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Aug 29, 2023
@OSBotify
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.

@melvin-bot
Copy link

melvin-bot bot commented Aug 29, 2023

Triggered auto assignment to @jasperhuangg (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Aug 29, 2023

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

@melvin-bot melvin-bot bot added Daily KSv2 and removed Hourly KSv2 labels Aug 29, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 29, 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

@luacmartins
Copy link
Contributor

This happens in prod, so NAB. This is the console error I'm seeing.
Screenshot 2023-08-29 at 3 22 59 PM

Thrown here:
Screenshot 2023-08-29 at 3 23 21 PM

@luacmartins luacmartins removed the DeployBlockerCash This issue or pull request should block deployment label Aug 29, 2023
@s-alves10
Copy link
Contributor

Proposal

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

App crashes when revisiting a thread from left room

What is the root cause of that problem?

When we leave the room, the API returns the following data, that is, clears the room report
image

When we revisit the chat thread after that, the originalReport becomes null below

const originalReportID = ReportUtils.getOriginalReportID(props.report.reportID, props.action);
const originalReport = props.report.reportID === originalReportID ? props.report : ReportUtils.getReport(originalReportID);

When rendering mini context menu, we call ReportUtils.chatIncludesChronos below

isChronosReport={ReportUtils.chatIncludesChronos(originalReport)}

and chatIncludesChronos doesn't check the validity of the report as you can see below

App/src/libs/ReportUtils.js

Lines 2895 to 2897 in cb98bec

function chatIncludesChronos(report) {
return report.participantAccountIDs && _.contains(report.participantAccountIDs, CONST.ACCOUNT_ID.CHRONOS);
}

This is the root cause

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

We can use lodashGet in chatIncludesChronos function instead of referring the property directly

function chatIncludesChronos(report) {
    const participants = lodashGet(report, ['participantAccountIDs']);
    return participants && _.contains(participants, CONST.ACCOUNT_ID.CHRONOS);
}

This works as expected

What alternative solutions did you explore? (Optional)

@hungvu193
Copy link
Contributor

Post the proposal where I'm the reporter, I think @izarutskaya forgot to post it 🤦

Proposal

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

App crashed when revisiting thread from left room.

What is the root cause of that problem?

When leave a room, we merge our report to null here:

value: _.object(reportKeys, Array(reportKeys.length).fill(null)),

Later when we use it here, our originalReport will be temporary null.

const originalReport = props.report.reportID === originalReportID ? props.report : ReportUtils.getReport(originalReportID);

It will lead the App to crash here:

App/src/libs/ReportUtils.js

Lines 2734 to 2736 in 893c2a5

function chatIncludesChronos(report) {
return report.participantAccountIDs && _.contains(report.participantAccountIDs, CONST.ACCOUNT_ID.CHRONOS);
}

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

We can use lodashGetto get the value of participantAccountIDs inside chatIncludesChronos function.

const participantAccountIDs = lodashGet(report, 'participantAccountIDs', []);
// then use `participantAccountIDs` after that.

Or we can add more condition here to early return if report is null:

return report && report.participantAccountIDs && _.contains(report.participantAccountIDs, CONST.ACCOUNT_ID.CHRONOS);

What alternative solutions did you explore? (Optional)

N/A

@luacmartins luacmartins added the External Added to denote the issue can be worked on by a contributor label Aug 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 30, 2023

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

@melvin-bot melvin-bot bot changed the title App crashed when revisiting thread from left room [$1000] App crashed when revisiting thread from left room Aug 30, 2023
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 30, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 30, 2023

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

@robertKozik
Copy link
Contributor

Hi all @s-alves10 @hungvu193 ! I wanted to check your proposals but I have problems with reproduction. Could you check on your end that it's still reproducible?

Screen.Recording.2023-08-31.at.13.40.44.mov

@kbecciv
Copy link

kbecciv commented Aug 31, 2023

@hungvu193 No worries about your proposal.
@CortneyOfstad @luacmartins - he is reporter of the issue and his proposal - #26256 (comment)

@robertKozik
Copy link
Contributor

Thanks for confirming @kbecciv 🙇🏼‍♂️

@hoangzinh
Copy link
Contributor

I could not reproduce the bug too.

@CortneyOfstad
Copy link
Contributor

@hungvu193 Are you still able to reproduce this?

@hungvu193
Copy link
Contributor

I also couldn't reproduce

@melvin-bot melvin-bot bot added the Overdue label Sep 4, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 5, 2023

@CortneyOfstad, @luacmartins, @robertKozik Whoops! This issue is 2 days overdue. Let's get this updated quick!

@CortneyOfstad
Copy link
Contributor

@luacmartins @robertKozik Since this doesn't seem to be reproducible, good to close?

@melvin-bot melvin-bot bot removed the Overdue label Sep 5, 2023
@luacmartins
Copy link
Contributor

I think if we can't reliably reproduce this we should just close the issue

@s-alves10
Copy link
Contributor

For a few mins, please

@s-alves10
Copy link
Contributor

Yes. I wasn't able to reproduce this. Sorry

@luacmartins
Copy link
Contributor

Ok, gonna close this issue. Thanks for the discussion!

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. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

10 participants