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-07-06] [$1000] First message remains heighlighted on thread #19776

Closed
2 of 6 tasks
kavimuru opened this issue May 29, 2023 · 56 comments
Closed
2 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@kavimuru
Copy link

kavimuru commented May 29, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. go to any chat
  2. send any message
  3. click on reply in thread option
  4. go to thread and send any message
  5. go to previous chat
  6. click on same message and select reply in thread option

Expected Result:

first message should not be highlighted

Actual Result:

first message highlights

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

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.19-6
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

IMG_0409.mov
az_recorder_20230529_172540.1.mp4

Expensify/Expensify Issue URL:
Issue reported by: @gadhiyamanan
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1685076159930429

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01459c624ea436728a
  • Upwork Job ID: 1663582287105273856
  • Last Price Increase: 2023-06-20
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 29, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 29, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 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

@bernhardoj
Copy link
Contributor

Proposal

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

First message in thread is highlighted if we use Reply In Thread from (right-click) context menu.

What is the root cause of that problem?

One of the reason the message is highlighted is when a context menu is active. Each message compare its action ID with the active action ID.

isActiveReportAction(actionID) {
return Boolean(actionID) && this.state.reportAction.reportActionID === actionID;
}

The active action ID will be cleared once we close the context menu.

runAndResetOnPopoverHide() {
this.setState({reportID: '0', reportAction: {}}, () => {
this.onPopoverHide = this.runAndResetCallback(this.onPopoverHide);
this.onPopoverHideActionCallback = this.runAndResetCallback(this.onPopoverHideActionCallback);
});

One thing to keep in mind is that the thread first message action ID is the same as the thread parent action ID.
(thread parent action)
image
(thread first message action)
image

The problem is, when we click Reply in thread, it will navigate us to the thread report before hiding the context menu.

Screen.Recording.2023-05-30.at.17.03.11.mov

Notice the context menu is late to hide.

This is because we are delaying the hiding (first param of hideContextMenu)

Report.navigateToAndOpenChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID);
if (closePopover) {
hideContextMenu(true, ReportActionComposeFocusManager.focus);
}

So, when we already navigated to the thread report, the first message mounted and think that the context menu is still active (well, technically it's but we should immediately close it before navigate to the thread report)

function ReportActionItem(props) {
const [isContextMenuActive, setIsContextMenuActive] = useState(ReportActionContextMenu.isActiveReportAction(props.action.reportActionID));

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

  1. We shouldn't delay to close/hide the context
  2. If we are going to close/hide the context menu, i.e. closePopover is true, we should do the navigation after the hide completes.

Here is how it looks after both changes above:

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

What alternative solutions did you explore? (Optional)

Add reportID check in isActiveReportAction.

return Boolean(actionID) && Boolean(reportID) && this.state.reportID === reportID && this.state.reportAction.reportActionID === actionID;

This works well, but I think we should still apply the main solution above and this one just as an additional improvement.

@melvin-bot
Copy link

melvin-bot bot commented May 30, 2023

Looks like something related to react-navigation may have been mentioned in this issue discussion.

As a reminder, please make sure that all proposals are not workarounds and that any and all attempt to fix the issue holistically have been made before proceeding with a solution. Proposals to change our DeprecatedCustomActions.js files should not be accepted.

Feel free to drop a note in #expensify-open-source with any questions.

@puneetlath puneetlath added the External Added to denote the issue can be worked on by a contributor label May 30, 2023
@melvin-bot melvin-bot bot changed the title First message remains heighlighted on thread [$1000] First message remains heighlighted on thread May 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 30, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 30, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 30, 2023

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

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

melvin-bot bot commented May 30, 2023

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

@melvin-bot melvin-bot bot added the Overdue label Jun 1, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 2, 2023

@puneetlath, @parasharrajat Whoops! This issue is 2 days overdue. Let's get this updated quick!

@puneetlath
Copy link
Contributor

@parasharrajat thoughts on the proposal?

@melvin-bot melvin-bot bot removed the Overdue label Jun 2, 2023
@parasharrajat
Copy link
Member

Reviewing.

@melvin-bot melvin-bot bot added the Overdue label Jun 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 6, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 6, 2023

@puneetlath, @parasharrajat Whoops! This issue is 2 days overdue. Let's get this updated quick!

@puneetlath
Copy link
Contributor

@parasharrajat thoughts on the proposals?

@melvin-bot melvin-bot bot removed the Overdue label Jun 7, 2023
@parasharrajat
Copy link
Member

Missed replying here. Thanks @bernhardoj for the proposal. So removing the delay will fix this issue. But why is the delay there? What will happen when we remove this?

@bernhardoj
Copy link
Contributor

I believe the delay is used when we want to show some icon/text changes in the context menu before closing it, e.g. copy to clipboard, mark as unread.

Screen.Recording.2023-06-08.at.11.49.05.mov

@parasharrajat
Copy link
Member

parasharrajat commented Jun 8, 2023

Thanks. There were two questions asked.

What will happen when we remove this?

What about this?

@bernhardoj
Copy link
Contributor

The context menu will immediately close. The example we can see is in edit/delete message, flag message.

function hideContextMenu(shouldDelay, onHideCallback = () => {}) {
if (!contextMenuRef.current) {
return;
}
if (!shouldDelay) {
contextMenuRef.current.hideContextMenu(onHideCallback);
return;
}
// Save the active instanceID for which hide action was called.
// If menu is being closed with a delay, check that whether the same instance exists or a new was created.
// If instance is not same, cancel the hide action
const instanceID = contextMenuRef.current.instanceID;
setTimeout(() => {
if (contextMenuRef.current.instanceID !== instanceID) {
return;
}
contextMenuRef.current.hideContextMenu(onHideCallback);
}, 800);
}

@parasharrajat
Copy link
Member

The context menu will immediately close.

That is obvious. So we will lose the ability to show the confirmation status of an action(e.g. for Copy to Clipboard). That will become another problem.

@melvin-bot melvin-bot bot added the Reviewing Has a PR in review label Jun 24, 2023
@bernhardoj
Copy link
Contributor

PR is ready for review.

cc: @parasharrajat

@melvin-bot
Copy link

melvin-bot bot commented Jun 27, 2023

🎯 ⚡️ Woah @parasharrajat / @bernhardoj, great job pushing this forwards! ⚡️

The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉

  • when @bernhardoj got assigned: 2023-06-23 16:47:54 Z
  • when the PR got merged: 2023-06-27 14:34:44 UTC

On to the next one 🚀

@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 29, 2023
@melvin-bot melvin-bot bot changed the title [$1000] First message remains heighlighted on thread [HOLD for payment 2023-07-06] [$1000] First message remains heighlighted on thread Jun 29, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 29, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 29, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 29, 2023

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

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.

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 Jun 29, 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:

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

@puneetlath
Copy link
Contributor

@gadhiyamanan @bernhardoj sent you both contracts.

@parasharrajat I assume you'll request payment via Expensify? And also, friendly reminder about the checklist 😄

@puneetlath
Copy link
Contributor

@parasharrajat friendly reminder so that we can pay this out tomorrow!

@parasharrajat
Copy link
Member

[@parasharrajat] The PR that introduced the bug has been identified. Link to the PR: I am not sure how to tag the real Root cause of PR. The solution was to remove the delay from the context menu hide but this delay was added before the threads were in the app so the root cause PR will be the one that added the threads. They should have removed the delay. #18522

[@parasharrajat] 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: https://github.com/Expensify/App/pull/18522/files#r1253404741

[@parasharrajat] 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: Not needed. This kind of bug can be found with testing.

[@parasharrajat] Determine if we should create a regression test for this bug. Yes

[@parasharrajat] 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.

Regression Test Steps

  1. Open any chat
  2. Send a message
  3. Long press/right-click the message to open a context menu
  4. Press Reply in the thread in the context menu.
  5. Verify the thread parent message is not highlighted

Do you agree 👍 or 👎 ?

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jul 5, 2023
@puneetlath
Copy link
Contributor

Thanks @parasharrajat.

You'll be requesting payment via NewDot, is that right?

@gadhiyamanan bump on accepting the Upwork offer.

@melvin-bot melvin-bot bot added the Overdue label Jul 10, 2023
@puneetlath
Copy link
Contributor

@gadhiyamanan and @bernhardoj have been paid. Just waiting for confirmation from @parasharrajat on whether they've requested payment in NewDot.

@melvin-bot melvin-bot bot removed the Overdue label Jul 10, 2023
@puneetlath puneetlath added Weekly KSv2 and removed Daily KSv2 labels Jul 10, 2023
@parasharrajat
Copy link
Member

I haven't requested it yet. Please wait a few more days. It takes about 5 days to credit so the waiting time is long. Good thing on putting this weekly. Thanks for the bump @puneetlath .

@parasharrajat
Copy link
Member

Requested payment on newDot 1500.

@anmurali
Copy link

Approved 1500 based on #19776 (comment)

@melvin-bot melvin-bot bot added the Overdue label Jul 24, 2023
@puneetlath
Copy link
Contributor

Great! Closing out.

@melvin-bot melvin-bot bot removed the Overdue label Jul 24, 2023
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 External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

7 participants