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 App Navigation Reboot #11768] [$1000] Web - Double click on message on user details page opens group with that user if group chat with that user is the latest chat #16557

Closed
1 of 6 tasks
kbecciv opened this issue Mar 27, 2023 · 36 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. 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 Monthly KSv2

Comments

@kbecciv
Copy link

kbecciv commented Mar 27, 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. Open the app
  2. Open any group (ensure that group is the latest chat)
  3. Click on any all user names or profiles on top of group
  4. From the list, select any one user
  5. Double click on 'Message username'

Expected Result:

App should open user chat as it does on normal click and normal double click on 'Message username' while navigating the user details from that user report or while the latest chat is not a group with that user

Actual Result:

App reopens the group chat (i.e. group chat which is current latest chat for user)

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

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

Recording.2383.mp4
double.click.issue.group.chat.mp4

Expensify/Expensify Issue URL:

Issue reported by: @dhanashree-sawant

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~011c35869503b85073
  • Upwork Job ID: 1641050959484149760
  • Last Price Increase: 2023-03-29
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 27, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

MelvinBot commented Mar 27, 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

@slafortune
Copy link
Contributor

Looks good!

@slafortune slafortune added the External Added to denote the issue can be worked on by a contributor label Mar 29, 2023
@melvin-bot melvin-bot bot changed the title Web - Double click on message on user details page opens group with that user if group chat with that user is the latest chat [$1000] Web - Double click on message on user details page opens group with that user if group chat with that user is the latest chat Mar 29, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

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

@MelvinBot
Copy link

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

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

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

@alexxxwork
Copy link
Contributor

alexxxwork commented Mar 29, 2023

Proposal

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

App opens wrong chat when double-click on 'message user' from user details page opened from group chat

What is the root cause of that problem?

This issue is caused by double calling Report.navigateToAndOpenReport([details.login]) here:

onPress={() => Report.navigateToAndOpenReport([details.login])}

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

We could disable menu item after pressing here:

<MenuItem
title={`${this.props.translate('common.message')}${details.displayName}`}
icon={Expensicons.ChatBubble}
onPress={() => Report.navigateToAndOpenReport([details.login])}
wrapperStyle={styles.breakAll}
shouldShowRightIcon
/>

like so:

<MenuItem
    title={`${this.props.translate('common.message')}${details.displayName}`}
    icon={Expensicons.ChatBubble}
    onPress={() => { this.setState({messageButtonDisabled:true}); Report.navigateToAndOpenReport([details.login])}}
    wrapperStyle={styles.breakAll}
    shouldShowRightIcon
    disabled={this.state.messageButtonDisabled}
/>

To do so we also need to add state to the DetailsPage component and it's better to write a function for onPress

@tienifr
Copy link
Contributor

tienifr commented Mar 29, 2023

Proposal

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

App reopens the group chat (i.e. group chat which is current latest chat for user) when double clicking on 'Message username' in the group member profile.

What is the root cause of that problem?

The root cause is in this line where it triggered twice when double clicking on the MenuItem https://github.com/Expensify/App/blob/main/src/pages/DetailsPage.js#L191. This is the exact same problem that we faced before with the OptionRow in this issue.

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

We should apply the same fix as for the OptionRow, you can see the that solution in here.

To elaborate the fix:

We should update the MenuItem component so that it:

  1. Disables the Pressable in its onPress callback
    By adding const [isDisabled, setIsDisabled] = useState(false); to the component and then use setIsDisabled(true); after this line in onPress
  2. Saves a reference to the value returned by props.onPress here (called result).
  3. Calls InteractionManager.runAfterInteraction, and in the callback to runAfterInteraction:
    Checks if the value from result is a promise. If so, wait for the promise to resolve. This is to provide a mechanism by which we can wait for business logic to complete before re-enabling the Pressable, if we want to.
    Then re-enables the Pressable by setIsDisabled(false)

More specifically, add the following code to replace this line.

let result = props.onPress(e);

if (!(result instanceof Promise)) {
    result = Promise.resolve();
}

InteractionManager.runAfterInteractions(() => {
    result.then(() => setIsDisabled(false));
});

This line

disabled={props.disabled}
also needs to be updated to disabled={props.disabled || isDisabled}

What alternative solutions did you explore?

  • If we want to fix for more such component we can apply the same fix, the above will work for all MenuItem.
  • If in any case we don't want the above prevent-double-click logic to apply to all MenuItem, we can introduce a prop to MenuItem like preventDoubleClick and only have the above logic if that prop is true

@Litande
Copy link

Litande commented Mar 29, 2023

Proposal

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

Double click on message on user details page opens group with that user if group chat with that user is the latest chat

What is the root cause of that problem?

the second click on "message USER" cancel navigation and returns back to prev screen.

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

we can change the call on press in DetailsPage like this it will effectivly cause a single click on this button and block others.
onPress={_.once(function () { Report.navigateToAndOpenReport([details.login]) })}

What alternative solutions did you explore? (Optional)

@MelvinBot
Copy link

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.

@alexxxwork
Copy link
Contributor

alexxxwork commented Mar 29, 2023

We should apply the same fix as for the OptionRow, you can see the that solution in here.

@tienifr thanks for the reference! Right now DetailsPage is a class component. So we should either leave it as a class and use constructor or make it a function and use useState callback.

@ShogunFire
Copy link
Contributor

Proposal

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

When we double click on a profile name the screen stays the same instead of going to the chat of the user

What is the root cause of that problem?

We use a custom action for navigation from a drawer.

In this method

The first time we click, it pushes the new route to the stack.

On the second click it sees that we are on the same screen so it doesn't push the new route and return here

return DrawerActions.closeDrawer();

The problem is that before we return we pop everything from the stack so we return to the screen before the first click here:

navigateBackToRootDrawer();

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

We can do the check if we are on the same screen before popping the stack. That way if we are on the same screen we don't pop the stack and stay on the same screen.

Since changing DeprecatedCustomActions is not an option we can put the check before calling pushDrawerRoute

What alternative solutions did you explore? (Optional)

@ShogunFire
Copy link
Contributor

Can someone clarify why modifying DeprecatedCustomActions.js should not be accepted ? It looks like it is there that there is a problem

@alexxxwork
Copy link
Contributor

Can someone clarify why modifying DeprecatedCustomActions.js should not be accepted ? It looks like it is there that there is a problem

@ShogunFire as far as I know it's due to upcoming navigation system rebuild

@tienifr
Copy link
Contributor

tienifr commented Mar 30, 2023

@tienifr thanks for the reference! Right now DetailsPage is a class component. So we should either leave it as a class and use constructor or make it a function and use useState callback.

Thanks @alexxxwork for the feedback, in my proposal I'm not touching the DetailsPage component, I'm only modifying the MenuItem component and used useState there.

@alexxxwork
Copy link
Contributor

Thanks @alexxxwork for the feedback, in my proposal I'm not touching the DetailsPage component, I'm only modifying the MenuItem component and used useState there.

@tienifr sorry, missed it. So you are making the changes global? I don't think it's a universal approach to disable MenuItem after pressing it. How do you propose to turn it back when there's no promise in result?

@alexxxwork
Copy link
Contributor

Instead there better be a prop to the component similar to shouldDelayFocus - shouldDelayPressing that allows to disable onPress for 300ms or so.

@tienifr
Copy link
Contributor

tienifr commented Mar 30, 2023

@alexxxwork it was the same way we're doing with the OptionRow, you can read more details there if curious about the approach 😁

@ShogunFire
Copy link
Contributor

Can someone clarify why modifying DeprecatedCustomActions.js should not be accepted ? It looks like it is there that there is a problem

@ShogunFire as far as I know it's due to upcoming navigation system rebuild

Then I think we should hold this issue until the new navigation system rebuild

@thesahindia
Copy link
Member

I couldn't repro this issue. Is there anything else that I should be doing?

@MelvinBot
Copy link

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

@thesahindia
Copy link
Member

It's on hold!

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Apr 10, 2023
@MelvinBot
Copy link

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

@thesahindia
Copy link
Member

Same #16557 (comment)

@melvin-bot melvin-bot bot removed the Overdue label Apr 14, 2023
@slafortune
Copy link
Contributor

Changing to weekly 👍

@slafortune slafortune added Weekly KSv2 and removed Daily KSv2 labels Apr 14, 2023
@melvin-bot melvin-bot bot added the Overdue label Apr 24, 2023
@slafortune
Copy link
Contributor

Still on hold for #11768

@melvin-bot melvin-bot bot removed the Overdue label May 2, 2023
@melvin-bot melvin-bot bot added the Overdue label May 10, 2023
@slafortune
Copy link
Contributor

Still on hold

@melvin-bot melvin-bot bot removed the Overdue label May 10, 2023
@melvin-bot melvin-bot bot added the Overdue label May 19, 2023
@slafortune
Copy link
Contributor

Still on hold

@melvin-bot melvin-bot bot removed the Overdue label May 25, 2023
@slafortune slafortune added Monthly KSv2 Overdue and removed Weekly KSv2 labels May 25, 2023
@melvin-bot melvin-bot bot removed the Overdue label May 25, 2023
@melvin-bot melvin-bot bot added the Overdue label Jun 26, 2023
@slafortune
Copy link
Contributor

still on hold

@melvin-bot melvin-bot bot removed the Overdue label Jun 27, 2023
@melvin-bot melvin-bot bot added the Overdue label Jul 28, 2023
@slafortune
Copy link
Contributor

Testing this since #11768 has been closed - seems to operate as expected now. Double-clicking open chat for the person selected only.

@melvin-bot melvin-bot bot removed the Overdue label Jul 31, 2023
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. 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 Monthly KSv2
Projects
None yet
Development

No branches or pull requests

10 participants