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-20] [$1000] Chat - Shows error “OpenReport returned error” when click Reply in new thread #25538

Closed
2 of 6 tasks
lanitochka17 opened this issue Aug 19, 2023 · 50 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 Aug 19, 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. Login same account on Two platforms
  2. Platform A : open Context Menu for a message
  3. Platform B : open Context Menu for same message
  4. Platform B : Click reply Reply in thread -> Send any message
  5. Platform A : Click Reply in thread

Expected Result:

It should not show error and show reply screen with one message sent

Actual Result:

Shows error when click Reply in new thread

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: 1.3.55-7

Reproducible in staging?: Yes

Reproducible in production?: Yes

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

Image.from.iOS.15.MP4
0-02-01-f7f385c9b89c216a4fffdb14623a06a08239f66e4933de23f402ef0c286a32d0_a09bee0eb86d0c6c.1.mp4

Expensify/Expensify Issue URL:

Issue reported by: @DinalJivani

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~013f08abe4343ca397
  • Upwork Job ID: 1693834671655858176
  • Last Price Increase: 2023-09-05
  • Automatic offers:
    • jjcoffee | Reviewer | 26529486
    • dukenv0307 | Contributor | 26529489
    • DinalJivani | Reporter | 26529490
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 19, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 19, 2023

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

@melvin-bot
Copy link

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

@ahmdshrif
Copy link
Contributor

ahmdshrif commented Aug 20, 2023

Proposal

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

The issue occurs when we open the context menu upon receiving the first message in the thread. Subsequently, when we attempt to reply within the thread using the 'Reply in Thread' option, the thread that was opened showed an error."

What is the root cause of that problem?

The main issue arises from how the context menu functions. When we open the context menu, it captures and stores the current report actions. However, if someone responds from a different platform or account, a new conversation thread is generated for that response. Unfortunately, this updated information doesn't reach the context menu – this is because we only send it when using showContextMenu.

This leads to a problem when we attempt to reply within the thread. The system mistakenly tries to create a new thread for the report action, resulting in a backend error. Fortunately, refreshing the interface corrects this.

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

Instead of relying solely on the data we get when the user initially opens the report, we can take a different approach. We should call for a refresh of the report action data using the report ID and the received report action. This way, when the user clicks "Reply" in the thread, they'll get the latest report action data. This updated data will include the newly created thread for that action. This means they'll be directed to the correct thread, avoiding the creation of a new thread and any associated errors.

to do that will need to update the following: -

onPress: (closePopover, {reportAction, reportID}) => {
if (closePopover) {
hideContextMenu(false, () => {
ReportActionComposeFocusManager.focus();
Report.navigateToAndOpenChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID);
});
return;
}
Report.navigateToAndOpenChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID);
},
getDescription: () => {},
},

onPress: (closePopover, {reportAction, reportID}) => {
// update report data . 
    const currentReportAction = ReportActionUtils.getReportAction(reportID, reportAction.reportActionID);
    if (closePopover) {
        hideContextMenu(false, () => {
            ReportActionComposeFocusManager.focus();
            Report.navigateToAndOpenChildReport(lodashGet(currentReportAction, 'childReportID', '0'), currentReportAction, reportID);
        });
        return;
    }

    Report.navigateToAndOpenChildReport(lodashGet(currentReportAction, 'childReportID', '0'), currentReportAction, reportID);
},

Update

for the second issue introduced here

We can still use the same approach by getting the report by ID in all Context Menu Actions

const currentReportAction = ReportActionUtils.getReportAction(reportID, reportAction.reportActionID);

and we may refactor the context menu actions to only take the reportActionID instead or reportAction

What alternative solutions did you explore? (Optional)

N/A

@tienifr
Copy link
Contributor

tienifr commented Aug 21, 2023

Proposal

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

Chat - Shows error “OpenReport returned error” when click Reply in new thread

What is the root cause of that problem?

We're storing reportAction in state

and set this state only when we execute showContextMenu function. That why when users update report action from other devices, PopoverReportActionContextMenu from first device can not aware the new update => lodashGet(reportAction, 'childReportID', '0') is 0

=> we will create the new report that already exists

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

Solution 1: Store reportActionID in PopoverReportActionContextMenu instead of reportAction (like what we did with reportID). So we will use ReportActionUtils.getReportAction to get the report action when we need it

Solution 2: Update reportAction state of PopoverReportActionContextMenu whenever it gets changed using useEffect

What alternative solutions did you explore? (Optional)

None

@melvin-bot melvin-bot bot added the Overdue label Aug 22, 2023
@adelekennedy
Copy link

reproducible

@melvin-bot melvin-bot bot removed the Overdue label Aug 22, 2023
@adelekennedy adelekennedy added External Added to denote the issue can be worked on by a contributor Overdue labels Aug 22, 2023
@melvin-bot melvin-bot bot changed the title Chat - Shows error “OpenReport returned error” when click Reply in new thread [$1000] Chat - Shows error “OpenReport returned error” when click Reply in new thread Aug 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 22, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 22, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 22, 2023

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

@akamefi202
Copy link
Contributor

I think this issue has same RCA with #25539.
Maybe we can find one solution to fix both issues.

@adelekennedy
Copy link

@jjcoffee what do you think? Should we combine this issue and #25539?

@melvin-bot melvin-bot bot removed the Overdue label Aug 22, 2023
@jjcoffee
Copy link
Contributor

@adelekennedy Agree, sounds like the same RCA - they both deal with the reportAction stored in state not being updated. Same bug reporter too 😅

@dukenv0307
Copy link
Contributor

dukenv0307 commented Aug 29, 2023

Proposal

Bring proposal from #25539 this can fix both issues

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

Chat - Shows error “OpenReport returned error” when click Reply in new thread
Chat - Message not updated in Edit message box

What is the root cause of that problem?

reportAction is a state in PopoverReportActionContextMenu and it's only updated when the first time we open context menu. So when current reportAction is changed, this state isn't updated.

reportAction={this.state.reportAction}

We have the same issue with copy to clipboard action

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

Instead of passing reportAction to showContextMenu function, we can pass reportActionID to this. And then in BaseReportActionContextMenu we will subscribe reportActions in Onyx to get the reportAction with props.reprotActionID to make reportAction is updated

To avoid unnecessary re-render we can use memo to only compare the reportAction with reportActionID in BaseReportActionContextMenu

We also need to add an extra filed when we show context menu like originalReportID that is the current report of the reportAction and use it to get the reportAction from Onyx. This is necessary because with the thread first chat originalReportID and reportID is different.

What alternative solutions did you explore? (Optional)

Some other solution for this issue

For each option in ContextMenuActions, in onPress, we can get the updated reportAction by using ReportActionUtils.getReportAction(reportID, reportAction.reportActionID) and use this to do the action.

Result

Screencast.from.15-08-2023.12.40.29.webm

@melvin-bot
Copy link

melvin-bot bot commented Aug 29, 2023

@jjcoffee, @adelekennedy Huh... This is 4 days overdue. Who can take care of this?

@jjcoffee
Copy link
Contributor

@adelekennedy I guess we're waiting for a response to your comment on the related issue before proposal review can start?

@melvin-bot melvin-bot bot removed the Overdue label Aug 29, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 29, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@DinalJivani
Copy link

@jjcoffee
As this both issues were having same RCA, Decided to merge the other issue in this!

@melvin-bot
Copy link

melvin-bot bot commented Sep 12, 2023

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

@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 12, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Chat - Shows error “OpenReport returned error” when click Reply in new thread [HOLD for payment 2023-09-20] [$1000] Chat - Shows error “OpenReport returned error” when click Reply in new thread Sep 13, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Sep 13, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 13, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 13, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.68-17 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-20. 🎊

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 13, 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:

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

@DinalJivani
Copy link

@adelekennedy
This issue was logged before 30th Aug so the reporting bonus will be $250. I already accepted the Offer but it was of $50 instead of $250.
So, Can you please add 200 as bonus while approving milestone

@adelekennedy
Copy link

adelekennedy commented Sep 21, 2023

Payouts due:

Issue Reporter: $250 @DinalJivani Upwork
Contributor: $1000 + $500 speed bonus @dukenv0307 Upwork
Contributor+: $1000 + $500 speed bonus @jjcoffee Upwork

Eligible for 50% #urgency bonus? Y

Upwork job is here.

@melvin-bot melvin-bot bot removed the Overdue label Sep 21, 2023
@jjcoffee
Copy link
Contributor

@adelekennedy Not sure if you missed that there was a regression here.

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

melvin-bot bot commented Sep 25, 2023

@tgolen, @jjcoffee, @adelekennedy, @dukenv0307 Whoops! This issue is 2 days overdue. Let's get this updated quick!

@tgolen
Copy link
Contributor

tgolen commented Sep 25, 2023

just waiting for payouts

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Sep 25, 2023
@tgolen
Copy link
Contributor

tgolen commented Sep 29, 2023

@adelekennedy What do we need to do to finish up payments on this one?

@melvin-bot melvin-bot bot removed the Overdue label Sep 29, 2023
@adelekennedy
Copy link

@jjcoffee I missed the regression above - in this case because it was my error I won't ask for a refund

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

No branches or pull requests

9 participants