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-04-07] [$4000] Inconsistent behaviour for Manage Member's search & Invite member's search #15661

Closed
1 of 6 tasks
kavimuru opened this issue Mar 4, 2023 · 59 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

@kavimuru
Copy link

kavimuru commented Mar 4, 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. Navigate to Settings > Workspaces > Select any workspace
  3. Manage members
  4. Write something in Search
  5. Click Invite members then Go back
  6. Notice that the search value is still present
  7. Now go to Invite members > Write something in Search > Go back
  8. Click on Invite members again > You'll notice that previous search value is not present

Expected Result:

Behavior should be consistent for all sections

Actual Result:

Different behavior is being observed

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.78-0
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:

manage-vs-invite.mp4
Recording.1627.mp4

Expensify/Expensify Issue URL:
Issue reported by: @daraksha-dk
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1677844622336169

View all open jobs on GitHub

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

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

@melvin-bot melvin-bot bot locked and limited conversation to collaborators Mar 4, 2023
@MelvinBot
Copy link

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

@melvin-bot melvin-bot bot added the Overdue label Mar 6, 2023
@MelvinBot
Copy link

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

@anmurali anmurali added the External Added to denote the issue can be worked on by a contributor label Mar 7, 2023
@melvin-bot melvin-bot bot unlocked this conversation Mar 7, 2023
@melvin-bot melvin-bot bot changed the title Inconsistent behaviour for Manage Member's search & Invite member's search [$1000] Inconsistent behaviour for Manage Member's search & Invite member's search Mar 7, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

Current assignee @anmurali 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 - @sobitneupane (External)

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

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

@anmurali
Copy link

anmurali commented Mar 7, 2023

This is where the issue was previously discussed

@melvin-bot melvin-bot bot removed the Overdue label Mar 7, 2023
@osofus
Copy link

osofus commented Mar 8, 2023

It is not really inconsistent behaviour. If you go back from the 'manage members' page, the search text will get cleared.
The reason it doesn't clear when you go into 'invite members' page is the 'manage members' page is not unmounted.
The app has to be keep the page in memory, so the user can go back to it.
It is unmounted when you go back from the 'manage members' page, which is what happens when you go back from the 'invite members' page.

@you1996
Copy link

you1996 commented Mar 8, 2023

Proposal

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

The issue at hand pertains to inconsistent behavior observed in Manage Member's search and Invite Member's search, where the inputs are sometimes empty, and sometimes carry over their previous value. This inconsistency needs to be resolved.

What is the root cause of that problem?

The root cause of this issue is related to memory management in React. While this behavior is not necessarily problematic, it is expected that a visited page will be stored for easy access when a user revisits it. In this case, when a user inputs text in the text input, the current page (i.e., members page) and all its values are stored. When the user navigates to the next page (i.e., invite members), the browser mounts the invite members page with all its components. When the user navigates back from invite to members, the browser uses the saved copy of the page.

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

To ensure consistency and resolve the issue, it is suggested to clear the data ( input value) in the Manage Member's search in the componentWillUnmount(). This solution is chosen because users expect that no data will be saved in a search bar when they leave a page.

<TextInput
value={this.state.searchValue}
onChangeText={this.updateSearchValue}
placeholder={this.props.translate('optionsSelector.nameEmailOrPhoneNumber')}
/>

@moezh
Copy link

moezh commented Mar 8, 2023

Proposal

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

The current issue is that when a user navigates back from the Invite member page, the search text is cleared.

What is the root cause of that problem?

The cause of this issue is that the current component WorkspaceInvitePage is not needed anymore when navigating back. When a component is not needed, it's get unmounted by React and all its states are lost. In our case this will clear the search term.

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

To address the root cause of the problem, we can temporarily save the search term state in the local storage. Here's what we can do:

  • Save the search value in the local storage when the WorkspaceInvitePage component will unmount.
  • Retrieve the search value from the local storage when the WorkspaceInvitePage component is being initiated.
  • Remove the search term value from the local storage when the parent component WorkspaceMembersPage will unmount.
Screen.Recording.2023-03-08.at.2.04.14.PM.mov

What alternative solutions did you explore? (Optional)

No alternative solutions were explored.

@melvin-bot melvin-bot bot added the Overdue label Mar 10, 2023
@anmurali
Copy link

@sobitneupane - thoughts on these proposals?

@melvin-bot melvin-bot bot removed the Overdue label Mar 11, 2023
@sobitneupane
Copy link
Contributor

sobitneupane commented Mar 13, 2023

@you1996 Thanks for your proposal.

I don't think use of componentWillUnmount will work here as WorkspaceMembersPage is not unmounted on navigating to WorkspaceInvitePage.

@sobitneupane
Copy link
Contributor

@moezh Thanks for your proposal.

But I believe the expected result is to remove the search term from WorspaceMembersPage not retain value in WorkspaceInvitePage

@tienifr
Copy link
Contributor

tienifr commented Mar 13, 2023

Proposal

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

Inconsistent behaviour for Manage Member's search & Invite member's search

What is the root cause of that problem?

When we move into the Invite Page, the Member Page is still mounted so the search value remains. But when back from the invite Page, the invite Page is unmounted immediately so the search value in the invite page doesn't remain

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

We should clear the input value when clicking the Invite Button

inviteUser() {
        this.setState({searchValue: ''});
        Navigation.navigate(ROUTES.getWorkspaceInviteRoute(this.props.route.params.policyID));
}

Result

Screen.Recording.2023-03-13.at.15.07.55.mov

What alternative solutions did you explore? (Optional)

We also could save the search value in the invite page, and the member page,... as a draft value (and save it in ONYX storage) like how we save the draft value in the composer

EDIT: This is more detail for this solution
Firstly, in /App/src/libs/actions/Policy.js we will create a new function to update the draft search value for the invite page

 * @param {String} policyID
 * @param {String} searchValue
 */
function saveinvitePageDraftSearchValue(policyID, searchValue) {
    Onyx.merge(`${ONYXKEYS.COLLECTION.INVITE_PAGE_DRAFT_SEARCH_VALUE}${policyID}`, searchValue);
}

Then in /App/src/pages/workspace/WorkspaceInvitePage.js whenever we update the searchValue we also update the draft value in the ONYX by the above function (consider using debound for this function). Also, we will get the draft value in the invite page

draftSearchValue: {
            key: props => `${ONYXKEYS.COLLECTION.INVITE_PAGE_DRAFT_SEARCH_VALUE}${props.route.params.policyID}`,
        },

and update the draftSearchValue in the constructor if the draftSearchValue is not empty

const {
            personalDetails,
            userToInvite,
        } = OptionsListUtils.getMemberInviteOptions(
            props.personalDetails,
            props.betas,
            **props.draftSearchValue || '',**
            this.getExcludedUsers(),
        );
        this.state = {
            **searchTerm: props.draftSearchValue || '',**
           ....
}

We also could update the draftSearchValue in ComponentDidMount

Result

Screen-Recording-2023-03-14-at-09.25.02.mp4

This is my draft implementation on the invite page, We could do the same on other pages like the manage member Page,...

@bernhardoj
Copy link
Contributor

bernhardoj commented Mar 13, 2023

Why would we want to remove the search value after navigating forward? The expected behavior only mentioned "Behavior should be consistent for all sections" but does not tell which behavior. Looking at the last step, they expect the search value at invite members page is saved. Saving/clearing the search value seems like a feature request to me which should be discussed whether it is required because it affects the UX of the app.

Edit: why I think it is a feature request.
I believe we don't have such expected behavior anywhere in the app. The current behavior is already aligned with other parts of the app, for example login form. You input the email, press continue, fill the password, go back and the email is still there. Continue again and you will find the password is empty. 100% not a bug.

@melvin-bot melvin-bot bot changed the title [$4000] Inconsistent behaviour for Manage Member's search & Invite member's search [HOLD for payment 2023-04-07] [$4000] Inconsistent behaviour for Manage Member's search & Invite member's search Mar 31, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 31, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

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

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

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

@MelvinBot
Copy link

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

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

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Apr 7, 2023
@MelvinBot
Copy link

@iwiznia, @anmurali, @sobitneupane, @situchan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

1 similar comment
@MelvinBot
Copy link

@iwiznia, @anmurali, @sobitneupane, @situchan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@anmurali
Copy link

@sobitneupane - can you take care of your checklist items?

@sobitneupane
Copy link
Contributor

sobitneupane commented Apr 11, 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:

  • The PR that introduced the bug has been identified. Link to the PR:

#15123

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

#15123 (comment)

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

https://expensify.slack.com/archives/C049HHMV9SM/p1681186634307459

@sobitneupane
Copy link
Contributor

Regression Test Proposal

  • Navigate to Settings > Workspaces > Select any workspace
  • Go to Manage members
  • Write something in search input
  • Click Invite button
  • Click back button on Invite members page
  • Verify that search value is cleared on Manage members page

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added the Overdue label Apr 13, 2023
@MelvinBot
Copy link

@iwiznia, @anmurali, @sobitneupane, @situchan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@iwiznia
Copy link
Contributor

iwiznia commented Apr 14, 2023

@sobitneupane agree with that regression test (I now realize I should've commented and not reacted to your comment). Can you take care of creating that new regression test?

@anmurali I think you need to pay here?

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Apr 14, 2023
@iwiznia
Copy link
Contributor

iwiznia commented Apr 17, 2023

Did we pay this already? If so, can we close this?

@melvin-bot melvin-bot bot removed the Overdue label Apr 17, 2023
@anmurali
Copy link

Sent contracts to them all, will pay and close this once they accept them

@sobitneupane
Copy link
Contributor

@anmurali Thanks. Accepted the offer.

@situchan
Copy link
Contributor

@anmurali accepted, thanks!

@anmurali
Copy link

@situchan
Copy link
Contributor

Not sure if timeline bonus is applicable here.

Based on https://ex-syt.glitch.me/?issue=15813&pr=16603:
(@anmurali you can use this link for other issues to save your time ⏲️)

Here's the Issue timeline analysis:
🐛 Issue created at: Sat, 04 Mar 2023 04:29:34 GMT
🧯 Help Wanted at: Tue, 07 Mar 2023 23:57:02 GMT
🕵🏻 Contributor assigned at: Mon, 27 Mar 2023 18:43:20 GMT
🛸 PR created at: Tue, 28 Mar 2023 04:31:15 GMT
🎯 PR merged at: Wed, 29 Mar 2023 16:27:24 GMT
⌛ Business Days Elapsed between assignment and PR merge: 2

💰 Timeline Bonus/Penalty: 50% Bonus! 🎉

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