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 #12917] [$1000] IOU - copy to clipboard appears before closing the context menu #13004

Closed
kavimuru opened this issue Nov 24, 2022 · 22 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 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

@kavimuru
Copy link

kavimuru commented Nov 24, 2022

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. Open any chat
  2. Send a request
  3. Long press on the IOU preview to bring up the context menu
  4. Tap outside of the context menu to close it

Expected Result:

The context menu closes without an additional screen displayed

Actual Result:

The copy to clipboard menu appears quickly before the context menu is closed

Workaround:

None

Platform:

Where is this issue occurring?

  • iOS
  • Android

Version Number: 1.2.35-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos:

Original report:
https://user-images.githubusercontent.com/43996225/203825089-02357973-ef8d-4bf5-b09d-2a8a77af0b46.mov

TRJ reproduction:
https://user-images.githubusercontent.com/16232057/205189920-13befcd3-cef1-4332-9492-ceb3e4a862f9.MP4

Tip: knock the playback speed down a bit to see it more clearly.

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit

@kavimuru kavimuru added Daily KSv2 Needs Reproduction Reproducible steps needed labels Nov 24, 2022
@melvin-bot
Copy link

melvin-bot bot commented Nov 28, 2022

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

@melvin-bot melvin-bot bot added the Overdue label Nov 28, 2022
@melvin-bot
Copy link

melvin-bot bot commented Nov 30, 2022

Huh... This is 4 days overdue. Who can take care of this?

@trjExpensify trjExpensify self-assigned this Dec 2, 2022
@trjExpensify
Copy link
Contributor

👋 Happened across this one hanging out here. I can reproduce it on a physical device (iOS 16, iPhone 13 Pro) on the latest staging app: v1.2.35-0.

Action Performed:

  1. Open any chat
  2. Send a request
  3. Long press on the IOU preview to bring up the context menu
  4. Tap outside of the context menu to close it

Actual Result
The copy to clipboard menu appears quickly before the context menu is closed

Expected Result
The context menu closes without this added step

RPReplay_Final1669942198.MP4

Pro-tip: knock the playback speed down a bit to see it more clearly.

Adding the Bug and External labels.

@melvin-bot melvin-bot bot removed the Overdue label Dec 2, 2022
@trjExpensify trjExpensify added Overdue Bug Something is broken. Auto assigns a BugZero manager. labels Dec 2, 2022
@melvin-bot
Copy link

melvin-bot bot commented Dec 2, 2022

Current assignee @trjExpensify is eligible for the Bug assigner, not assigning anyone new.

@trjExpensify trjExpensify added External Added to denote the issue can be worked on by a contributor and removed Needs Reproduction Reproducible steps needed labels Dec 2, 2022
@melvin-bot
Copy link

melvin-bot bot commented Dec 2, 2022

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

@melvin-bot melvin-bot bot changed the title Report popup is blink after closing [$1000] Report popup is blink after closing Dec 2, 2022
@melvin-bot
Copy link

melvin-bot bot commented Dec 2, 2022

Job added to Upwork: https://www.upwork.com/jobs/~01f143785cdc3e8069

@melvin-bot
Copy link

melvin-bot bot commented Dec 2, 2022

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 2, 2022
@melvin-bot
Copy link

melvin-bot bot commented Dec 2, 2022

Triggered auto assignment to @PauloGasparSv (External), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@trjExpensify trjExpensify changed the title [$1000] Report popup is blink after closing [$1000] IOU - copy to clipboard appears before closing the context menu Dec 2, 2022
@trjExpensify
Copy link
Contributor

@b1tjoy I noticed this PR where you're working on something in this area, I don't think it addresses this problem on IOU previews does it?

@b1tjoy
Copy link
Contributor

b1tjoy commented Dec 2, 2022

@trjExpensify Checking it now.

@trjExpensify
Copy link
Contributor

Nice! Any luck?

@b1tjoy
Copy link
Contributor

b1tjoy commented Dec 2, 2022

@trjExpensify The root cause of this issue is different from my PR trying to solve. I think it's a regression of PR #12735, and has been solved by PR #12917, issue not reproducible on latest main branch.

Maybe we should wait PR #12917 hit production, and close this issue.

@railway17
Copy link
Contributor

Proposal:

  1. Reproducible
    I was able to reproduce this isuse as mentioned here.
  2. Why?
    We are displaying context menu items based on shouldShow method in src/pages/home/report/ContextMenu/ContextMenuActions.js
    While checking shouldShow in copyToClipboard, we will compare reportAction name whther it is IOU or not like below
{
       textTranslateKey: 'reportActionContextMenu.copyToClipboard',
       icon: Expensicons.Clipboard,
       successTextTranslateKey: 'reportActionContextMenu.copied',
       successIcon: Expensicons.Checkmark,
       shouldShow: (type, reportAction) => (type === CONTEXT_MENU_TYPES.REPORT_ACTION
           && reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.IOU
           && !ReportUtils.isReportMessageAttachment(_.last(lodashGet(reportAction, ['message'], [{}])))),

       // If return value is true, we switch the `text` and `icon` on
       // `ContextMenuItem` with `successText` and `successIcon` which will fallback to

But there will be passed empty reportAction variable when hiding the context menu by hideContextMenu method in src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js as defined like below:

    hideContextMenu(onHideActionCallback) {
        if (_.isFunction(onHideActionCallback)) {
            this.onPopoverHideActionCallback = onHideActionCallback;
        }
        this.setState({
            reportID: '0',
            **reportAction: {},**
            selection: '',
            reportActionDraftMessage: '',
            isPopoverVisible: false,
        });
    }

  1. How to resolve?
    So, we need to update the reportAction after closing the context menu.
    We can do it in 2 ways
  • reportAction can be updated in setState callback
         this.setState({
             reportID: '0',
-            reportAction: {},
+            // reportAction: {},
             selection: '',
             reportActionDraftMessage: '',
             isPopoverVisible: false,
+        }, ()=> {
+            this.setState({reportAction: {}})
         });
     }
  • We can do it in componentDidUpdate
+    componentDidUpdate(prevProps, prevState) {
+        if (prevState.isPopoverVisible && !this.state.isPopoverVisible) {
+            this.setState({reportAction: {}})
+        }

....
this.setState({
            reportID: '0',
-           reportAction: {},
            selection: '',
            reportActionDraftMessage: '',
            isPopoverVisible: false,
        })
    }

Result will be like below:

Screen.Recording.2022-12-02.at.10.38.32.PM.mov

@PauloGasparSv
Copy link
Contributor

PauloGasparSv commented Dec 2, 2022

@railway17 were you on the very latest version of main?

Asking this because I just tested and reproduced the bug on my first try but then I pulled from main and the bug was gone. I can't reproduce this bug anymore here.

@railway17
Copy link
Contributor

@railway17 were you on the very latest version of main?

Asking this because I just tested and reproduced the bug on my first try but then I pulled from main and the bug was gone. I can'r reproduce this here.

Let me check with latest code.
But this issue has a very clear reason, so it should appear as long as there were not any changes in hideContextMenu method.

@railway17
Copy link
Contributor

Ah..
It was updated in latest main 🥲 and reportAction is updated inside runAndResetOnPopoverHide

@trjExpensify
Copy link
Contributor

Okay, niceee! I'm going to pop a hold in the title for #12917. I'll retest once it hits staging and then close it out.

@trjExpensify trjExpensify changed the title [$1000] IOU - copy to clipboard appears before closing the context menu [Hold #12917] [$1000] IOU - copy to clipboard appears before closing the context menu Dec 2, 2022
@melvin-bot melvin-bot bot added the Overdue label Dec 5, 2022
@PauloGasparSv
Copy link
Contributor

Not overdue, #12917 was deployed to staging

@melvin-bot melvin-bot bot removed the Overdue label Dec 5, 2022
@melvin-bot
Copy link

melvin-bot bot commented Dec 8, 2022

@PauloGasparSv, @trjExpensify, @aimane-chnaif Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label Dec 8, 2022
@trjExpensify
Copy link
Contributor

Okay, this has been deployed to production. I'm unable to reproduce it on the latest. @aimane-chnaif @PauloGasparSv can you give it a try for a secondary check and then we'll close it out.

@melvin-bot melvin-bot bot removed the Overdue label Dec 8, 2022
@PauloGasparSv
Copy link
Contributor

Cannot reproduce the issue here! Let's close this off : )

@aimane-chnaif
Copy link
Contributor

@trjExpensify The root cause of this issue is different from my PR trying to solve. I think it's a regression of PR #12735, and has been solved by PR #12917, issue not reproducible on latest main branch.

Maybe we should wait PR #12917 hit production, and close this issue.

This analysis should be correct. Not reproducible

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

6 participants