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

[$500] Thread - App crashes when leaving thread #33009

Closed
6 tasks done
lanitochka17 opened this issue Dec 13, 2023 · 48 comments
Closed
6 tasks done

[$500] Thread - App crashes when leaving thread #33009

lanitochka17 opened this issue Dec 13, 2023 · 48 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

Comments

@lanitochka17
Copy link

lanitochka17 commented Dec 13, 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!


Version Number: 1.4.12-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:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to any chat
  3. Send a message
  4. Right click on the message > Reply in thread
  5. Send a reply in thread
  6. Click on the 3-dot menu > Leave thread

Expected Result:

App does not crash

Actual Result:

App crashes

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

Bug6312071_1702491924994.crash.mp4

logs.txt

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~013140a2456ce85a0b
  • Upwork Job ID: 1736678963183497216
  • Last Price Increase: 2024-01-08
  • Automatic offers:
    • situchan | Contributor | 28096745
Issue OwnerCurrent Issue Owner: @dylanexpensify
@lanitochka17 lanitochka17 added the DeployBlockerCash This issue or pull request should block deployment label Dec 13, 2023
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.

Copy link

melvin-bot bot commented Dec 13, 2023

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

@abzokhattab
Copy link
Contributor

abzokhattab commented Dec 13, 2023

Proposal

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

App crashes when leaving thread

What is the root cause of that problem?

in the following line report.notificationPreference is null so it throws an error when it tries to access the length.

} else if ((isChatThread && props.report.notificationPreference.length) || isUserCreatedPolicyRoom || canLeaveRoom) {

image

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

this issue orginates because of the optimistic value we set when leaving a room:

App/src/libs/actions/Report.ts

Lines 2049 to 2058 in 41471e9

value: {
reportID,
stateNum: CONST.REPORT.STATE_NUM.SUBMITTED,
statusNum: CONST.REPORT.STATUS.CLOSED,
chatType: report.chatType,
parentReportID: report.parentReportID,
parentReportActionID: report.parentReportActionID,
policyID: report.policyID,
type: report.type,
},

here we dont add the notificationPreference

so we have two solutions

either to add notificationPreference as hidden:

     : {
                  onyxMethod: Onyx.METHOD.SET,
                  key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
                  value: {
                      reportID,
                      stateNum: CONST.REPORT.STATE_NUM.SUBMITTED,
                      statusNum: CONST.REPORT.STATUS.CLOSED,
                      chatType: report.chatType,
                      parentReportID: report.parentReportID,
                      parentReportActionID: report.parentReportActionID,
                      policyID: report.policyID,
                      type: report.type,
                      notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN,
                  },

or we add another condition that checks if thereport.notificationPreference exists first before accessing the length

#POC

Screen.Recording.2023-12-14.at.1.15.36.AM.mov

@situchan
Copy link
Contributor

I confirmed that this also happens on production. Not deploy blocker but it would be good to fix asap as it's "crash"
@abzokhattab's proposal looks good to me.

In addition, we can add fix some more optimistic data to be consistent with server.
For now, there's glitch. i.e. chat is archived optimistically and then restores back

Screen.Recording.2023-12-14.at.3.39.42.AM.mov

@DylanDylann
Copy link
Contributor

DylanDylann commented Dec 14, 2023

@situchan sorry for my late, could you help to check my proposal?

Proposal

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

App crashes when leaving thread

What is the root cause of that problem?

When leaving the room we don't set notificationPreference in optimistic Data and we using SET method to update thread report to ONYX. It caused notificationPreference is lost in the chat report.
One more thing, after leaving the room, the App don't redirect to the parent report.

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

we need to add fully optimistic data to match the data from BE.

I think we should redirect to the parent report after the user leaving room. In here


we should update like this

 if (isWorkspaceMemberLeavingWorkspaceRoom) {
        const participantAccountIDs = PersonalDetailsUtils.getAccountIDsByLogins([CONST.EMAIL.CONCIERGE]);
        const chat = ReportUtils.getChatByParticipants(participantAccountIDs);
        if (chat?.reportID) {
            Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(chat.reportID));
        }
+ return
    }
+    if (report?.parentReportID) {
+      Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.parentReportID));
+  }

What alternative solutions did you explore? (Optional)

NA

@Julesssss
Copy link
Contributor

I confirmed that this also happens on production.

I was unable to reproduce this on v1.4.11-25.

@situchan
Copy link
Contributor

@Julesssss constantly reproducible on production
Because of this crash, not able to test #33010. I think 2 issues can be fixed together in one PR.

Screen.Recording.2023-12-14.at.4.29.46.PM.mov

@situchan
Copy link
Contributor

Please test on public room

@Julesssss
Copy link
Contributor

I can't reproduce this in a 1:1 chat on web or Android. But yeah I can reproduce in a public room.

The problem is that a new regression has been introduced for the 1:1 chats, so as much as I'd like to drop this from being a blocker, we'll have to fix it asap.

@Julesssss Julesssss assigned Julesssss and unassigned puneetlath Dec 14, 2023
@blazejkustra
Copy link
Contributor

Turns out this PR also fixes crashes when leaving threads. cc @Julesssss

@situchan
Copy link
Contributor

yeah, confirmed PR fixes both issues.
I think notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN, should be applied to !isWorkspaceMemberLeavingWorkspaceRoom as well

@Julesssss Julesssss removed the DeployBlockerCash This issue or pull request should block deployment label Dec 14, 2023
@Julesssss
Copy link
Contributor

This was CP'd to staging and released. Removing the label.

@Julesssss Julesssss added Daily KSv2 and removed Hourly KSv2 labels Dec 14, 2023
@Julesssss Julesssss added the Bug Something is broken. Auto assigns a BugZero manager. label Dec 14, 2023
Copy link

melvin-bot bot commented Dec 14, 2023

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

This comment was marked as off-topic.

@situchan
Copy link
Contributor

situchan commented Jan 9, 2024

Btw, I already accepted your invite

Copy link

melvin-bot bot commented Jan 10, 2024

@Julesssss @dylanexpensify @situchan this issue is now 4 weeks old and preventing us from maintaining WAQ, can you:

  • Decide whether any proposals currently meet our guidelines and can be approved as-is today
  • If no proposals meet that standard, please take this issue internal and treat it as one of your highest priorities
  • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

Thanks!

@melvin-bot melvin-bot bot added Internal Requires API changes or must be handled by Expensify staff and removed 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 labels Jan 10, 2024
Copy link

melvin-bot bot commented Jan 10, 2024

Current assignee @situchan is eligible for the Internal assigner, not assigning anyone new.

@mvtglobally
Copy link

Issue not reproducible during KI retests. (Third week)

@melvin-bot melvin-bot bot added the Overdue label Jan 11, 2024
@melvin-bot melvin-bot bot removed the Overdue label Jan 12, 2024
@Julesssss Julesssss added External Added to denote the issue can be worked on by a contributor Overdue labels Jan 12, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 12, 2024
Copy link

melvin-bot bot commented Jan 12, 2024

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

@Julesssss
Copy link
Contributor

Hey @situchan did that work?

@situchan
Copy link
Contributor

Hey @situchan did that work?

Issue made internal after my comment so didn't work.
Can you please remove Internal, unassign and assign me back?
Thanks

@Julesssss Julesssss removed the Internal Requires API changes or must be handled by Expensify staff label Jan 12, 2024
@melvin-bot melvin-bot bot removed the Overdue label Jan 12, 2024
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 12, 2024
Copy link

melvin-bot bot commented Jan 12, 2024

📣 @situchan 🎉 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 📖

@situchan
Copy link
Contributor

Accepted offer. Thanks

@melvin-bot melvin-bot bot added the Overdue label Jan 14, 2024
@Julesssss
Copy link
Contributor

Not overdue

@dylanexpensify
Copy link
Contributor

paying now

@melvin-bot melvin-bot bot removed the Overdue label Jan 15, 2024
@dylanexpensify
Copy link
Contributor

done

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

No branches or pull requests

9 participants