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-27] [$500] Web - The delete confirmation modal fails to close when removing a member from another tab #26409

Closed
1 of 6 tasks
kbecciv opened this issue Aug 31, 2023 · 54 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

@kbecciv
Copy link

kbecciv commented Aug 31, 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. Navigate to Settings > Workspace > New workspace.
  2. Go to the Members section.
  3. Invite a member to the workspace.
  4. Select the member and click on "Remove."
  5. Copy the URL and paste it into another tab.
  6. In the new tab, remove the member.
  7. Return to the previous tab.
  8. The delete confirmation modal does not close, and the member is removed.

Expected Result:

The delete confirmation modal should close when a member is removed from another tab

Actual Result:

The delete confirmation modal does not close when removing a member from another tab

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

screen-recording-2023-08-25-at-21217-am_rzKSe8Rl.mp4
Recording.4126.mp4

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f4dfb3829fccd609
  • Upwork Job ID: 1699049489764618240
  • Last Price Increase: 2023-09-12
  • Automatic offers:
    • mollfpr | Reviewer | 26664911
    • DylanDylann | Contributor | 26664913
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 31, 2023
@GItGudRatio
Copy link
Contributor

Proposal

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

Delete Confirmation message does not disappear when a member is removed from another tab

What is the root cause of that problem?

In WorkspaceMembersPage, in ConfirmModal, we use the removeMembersConfirmModalVisible state to determine if the confirmation should be shown.

When the modal is open and a user is removed, we do not update this state.

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

We need to update the state value of removeMembersConfirmModalVisible to false whenever a user is removed from the workspace.

In my opinion, if any member of a workspace is removed and the modal is open, it should close so that the user can re consider. To implement this, we need to add setRemoveMembersConfirmModalVisible(false); here:

useEffect(() => {
setSelectedEmployees((prevSelected) =>
_.intersection(
prevSelected,
_.map(_.values(PolicyUtils.getMemberAccountIDsForWorkspace(props.policyMembers, props.personalDetails)), (accountID) => Number(accountID)),
),
);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [props.policyMembers]);

What alternative solutions did you explore? (Optional)

If we only want to dismiss the modal if the selected users have changed, we can modify the callback used in setSelectedEmployees so that the modal only dismissed if selected employees change.

@melvin-bot
Copy link

melvin-bot bot commented Aug 31, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 31, 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 Sep 4, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 4, 2023

@bfitzexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@bfitzexpensify
Copy link
Contributor

Sending this external

@melvin-bot melvin-bot bot removed the Overdue label Sep 5, 2023
@bfitzexpensify bfitzexpensify added the External Added to denote the issue can be worked on by a contributor label Sep 5, 2023
@melvin-bot melvin-bot bot changed the title Web - The delete confirmation modal fails to close when removing a member from another tab [$500] Web - The delete confirmation modal fails to close when removing a member from another tab Sep 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 5, 2023

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

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

melvin-bot bot commented Sep 5, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 5, 2023

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

@mollfpr
Copy link
Contributor

mollfpr commented Sep 6, 2023

I think the modal should be dismissed whenever the list member is changed (added or removed member).

@bfitzexpensify What do you think?

@bfitzexpensify
Copy link
Contributor

I agree, that behaviour makes sense to me

@DylanDylann
Copy link
Contributor

DylanDylann commented Sep 7, 2023

Proposal

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

Web - The delete confirmation modal fails to close when removing a member from another tab

What is the root cause of that problem?

We don't call setRemoveMembersConfirmModalVisible(false) when accountIDs list changes

  1. Add new accountID
  2. Remove AccountID
  3. Update accountID (in case inviting the new user (not exist yet) explain below)

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

we can use usePrevious to save the accountIDs and dismiss modal when the accountIDs changed like this

const accountIDs = useMemo(() => _.keys(props.policyMembers), [props.policyMembers])
   const prevAccountIDs = usePrevious(accountIDs);
   useEffect(() => {
       if (removeMembersConfirmModalVisible && !_.isEqual(accountIDs, prevAccountIDs)) {
           setRemoveMembersConfirmModalVisible(false);
       }    
       setSelectedEmployees((prevSelected) =>
           _.intersection(
               prevSelected,
               _.map(_.values(PolicyUtils.getMemberAccountIDsForWorkspace(props.policyMembers, props.personalDetails)), (accountID) => Number(accountID)),
           ),
       );
       // eslint-disable-next-line react-hooks/exhaustive-deps
   }, [props.policyMembers]);

With this approach,

  1. Adding new user (not exist yet) will dismiss the modal
  2. Adding existing user will not dismiss the modal
  3. Remove any member will dismiss the modal
    In point 1, we will dismiss modal because when invite new user offline (not exist yet) we will create optimistic accountID and when coming back online the BE will return another accountID for that user (you also see that the avatar of that user changed). It looks like that we remove the optimistic accountID and add new accountID for that user

@mollfpr
Copy link
Contributor

mollfpr commented Sep 8, 2023

In my opinion, if any member of a workspace is removed and the modal is open, it should close so that the user can re consider. To implement this, we need to add setRemoveMembersConfirmModalVisible(false); here:

@GItGudRatio Could you be more specific, is it inside the useEffect or the useState callback?


@DylanDylann May I ask why we're not using the props.policyMembers instead for the dependencies?

@GItGudRatio
Copy link
Contributor

@mollfpr it's inside the useEffect, above the useState callback.

@melvin-bot melvin-bot bot added the Overdue label Sep 11, 2023
@bfitzexpensify
Copy link
Contributor

@mollfpr how are things looking here? Seems like we're still working on finding the right proposal?

@melvin-bot melvin-bot bot removed the Overdue label Sep 11, 2023
@mollfpr
Copy link
Contributor

mollfpr commented Sep 11, 2023

Sorry for the delay! Testing the proposals now.

@DylanDylann
Copy link
Contributor

DylanDylann commented Sep 11, 2023

@mollfpr we can use props.personaldetail.length or data.length as dependency but i think we shouldn't use personalDetail or data because we only want dismiss modal if the number of member change

@mollfpr
Copy link
Contributor

mollfpr commented Sep 11, 2023

@mollfpr we can use props.personaldetail.length or data.length as dependency but i think we shouldn't use personalDetail or data because we only want dismiss modal if the number of member change

@DylanDylann I'm not sure I understand your point here. Your proposal is using data.length.

@GItGudRatio Could you update your RCA for this expected behavior here? Your solution works for removed users and when new users are added. Just to clarify that you're RCA is correct with the new expected.

@DylanDylann
Copy link
Contributor

@mollfpr We don't want to dismiss the modal if the display name of a member changes, right? So that, we only should put data.length or props.policyMembers.length as dependency of useEfffect

@DylanDylann
Copy link
Contributor

Updated proposal: #26409 (comment) with alternative solution

@melvin-bot
Copy link

melvin-bot bot commented Sep 13, 2023

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

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 14, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 14, 2023

📣 @mollfpr 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@melvin-bot
Copy link

melvin-bot bot commented Sep 14, 2023

📣 @DylanDylann 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot
Copy link

melvin-bot bot commented Sep 14, 2023

📣 @ayazhussain79 We're missing your Upwork ID to automatically send you an offer for the Reporter role.
Once you apply to the Upwork job, your Upwork ID will be stored and you will be automatically hired for future jobs!

@melvin-bot
Copy link

melvin-bot bot commented Sep 14, 2023

@johnmlee101 @mollfpr @bfitzexpensify @DylanDylann this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Sep 14, 2023
@DylanDylann
Copy link
Contributor

@mollfpr The PR is ready for review

@melvin-bot
Copy link

melvin-bot bot commented Sep 18, 2023

🎯 ⚡️ Woah @mollfpr / @DylanDylann, 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 @DylanDylann got assigned: 2023-09-14 02:15:10 Z
  • when the PR got merged: 2023-09-18 03:00:09 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 Weekly KSv2 labels Sep 20, 2023
@melvin-bot melvin-bot bot changed the title [$500] Web - The delete confirmation modal fails to close when removing a member from another tab [HOLD for payment 2023-09-27] [$500] Web - The delete confirmation modal fails to close when removing a member from another tab Sep 20, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Sep 20, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 20, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 20, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.71-12 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-27. 🎊

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

  • [@mollfpr] The PR that introduced the bug has been identified. Link to the PR:
  • [@mollfpr] 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:
  • [@mollfpr] 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:
  • [@mollfpr] Determine if we should create a regression test for this bug.
  • [@mollfpr] 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.
  • [@bfitzexpensify] 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 and removed Weekly KSv2 labels Sep 26, 2023
@mollfpr
Copy link
Contributor

mollfpr commented Sep 27, 2023

[@mollfpr] The PR that introduced the bug has been identified. Link to the PR:
[@mollfpr] 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:

No offending PRs. This improvement is to close the modal whenever the list is changed.

[@mollfpr] 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:

The regression step should be enough.

[@mollfpr] Determine if we should create a regression test for this bug.
[@mollfpr] 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.

  1. Navigate to Settings > Workspace > New workspace.
  2. Go to the Members section.

The confirmation modal should be closed when a new member is added in another tab/device

  1. Invite a member to the workspace.
  2. Select the member and click on "Remove."
  3. Copy the URL and paste it into another tab.
  4. In the new tab, remove the member.
  5. Return to the previous tab.
  6. Verify that the delete confirmation modal is closed

The confirmation modal should be closed when a new user is added from offline

  1. Go offline
  2. Invite a member (not exist yet like "qweqwe@gmail.com") to the workspace.
  3. Select the member and click on "Remove."
  4. Go online
  5. Verify that the delete confirmation modal is closed

The confirmation modal remains when existed user is added from offline

  1. Go offline
  2. Invite a member (who we chatted before) to the workspace.
  3. Select the member and click on "Remove."
  4. Go online
  5. Verify that the delete confirmation modal still remained

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

melvin-bot bot commented Oct 2, 2023

@johnmlee101, @mollfpr, @bfitzexpensify, @DylanDylann Eep! 4 days overdue now. Issues have feelings too...

@bfitzexpensify
Copy link
Contributor

All payments complete, issue opened for the regression test, we're good to close this one out. Thanks for the work, everyone!

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

6 participants