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 2024-08-14] [$250] Search - Delete modal message changes to ".. these expenses" briefly when clicking Cancel #45447

Closed
6 tasks done
m-natarajan opened this issue Jul 16, 2024 · 28 comments
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

@m-natarajan
Copy link

m-natarajan commented Jul 16, 2024

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


Issue found when validating #45143
Version Number: 9.0.7-4
Reproducible in staging?: y
Reproducible in production?: n
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
Expensify/Expensify Issue URL:
Issue reported by: applause internal team
Slack conversation:

Action Performed:

Precondition:

  • User has at least one unpaid expense.
  1. Go to staging.new.expensify.com
  2. Go to Search.
  3. Click on the checkbox next to one expense (one only, important)
  4. Click on the dropdown.
  5. Click Delete.
  6. Note that the modal message is "Are you sure that you want to delete this expense?"
  7. Click Cancel.
  8. Note that the modal message changes to "Are you sure that you want to delete these expenses?" quickly before it disappears.

Expected Result:

The delete modal message should be consistent and not change when clicking Cancel button.

Actual Result:

The delete modal message changes from "Are you sure that you want to delete this expense?" to "Are you sure that you want to delete these expenses?" after clicking Cancel button.

This issue only happens when one expense is selected.

Workaround:

unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6543389_1721092571591.20240716_091035.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01086f676b97015a4f
  • Upwork Job ID: 1815203340945056905
  • Last Price Increase: 2024-07-22
  • Automatic offers:
    • abdulrahuman5196 | Reviewer | 103247059
Issue OwnerCurrent Issue Owner: @slafortune
@m-natarajan m-natarajan added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. DeployBlocker Indicates it should block deploying the API labels Jul 16, 2024
Copy link

melvin-bot bot commented Jul 16, 2024

Triggered auto assignment to @slafortune (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

Copy link

melvin-bot bot commented Jul 16, 2024

Triggered auto assignment to @robertjchen (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@neonbhai
Copy link
Contributor

Proposal

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

Search - Delete modal message changes to ".. these expenses" briefly when clicking Cancel

What is the root cause of that problem?

When deletign expenses we clear the selected items.

const handleDeleteExpenses = () => {
if (selectedItemsToDelete.length === 0) {
return;
}
clearSelectedItems();
setDeleteExpensesConfirmModalVisible(false);
SearchActions.deleteMoneyRequestOnSearch(hash, selectedItemsToDelete);
};

This changes the translation from pural to singular notation for a second. This causes the text change

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

We will clear selected options after we have hidden the modal here

@Krishna2323
Copy link
Contributor

Krishna2323 commented Jul 16, 2024

Proposal

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

Search - Delete modal message changes to ".. these expenses" briefly when clicking Cancel

What is the root cause of that problem?

The delete options are cleared before the close animation happens.

const handleOnCancelConfirmModal = () => {
setSelectedItemsToDelete([]);
setDeleteExpensesConfirmModalVisible(false);
};

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

Use interaction manager to clear delete options after animation.

    const handleOnCancelConfirmModal = () => {
        setDeleteExpensesConfirmModalVisible(false);
        InteractionManager.runAfterInteractions(() => {
            setSelectedItemsToDelete([]);
        });
    };

Do the same with handleOnSelectDeleteOption function.

const handleOnSelectDeleteOption = (itemsToDelete: string[]) => {
setSelectedItemsToDelete(itemsToDelete);
setDeleteExpensesConfirmModalVisible(true);
};

What alternative solutions did you explore? (Optional)

We can use setTimeout instead of InteractionManager.

@tienifr
Copy link
Contributor

tienifr commented Jul 16, 2024

Proposal

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

  • The delete modal message changes from "Are you sure that you want to delete this expense?" to "Are you sure that you want to delete these expenses?" after clicking Cancel button.

What is the root cause of that problem?

  • The delete modal message is "Are you sure that you want to delete this expense?" or "Are you sure that you want to delete these expenses?" based on the count value:

    deleteExpense: ({count}: DeleteExpenseTranslationParams = {count: 1}) => `Delete ${Str.pluralize('expense', 'expenses', count)}`,

  • In case of the bug, when selecting one transaction, then click on "Delete" button in header, the delete modal is displayed. Here, we call:

    setSelectedItemsToDelete(itemsToDelete);

    so the selectedItemsToDelete.length is 1, so "Are you sure that you want to delete this expense?" is displayed.

  • Then if we click on "Cancel" button, we call:

    setSelectedItemsToDelete([]);

    so the selectedItemsToDelete.length is 0.

  • Here, when the modal is still displayed for a while before fully disappearing, the modal is displayed as "Are you sure that you want to delete these expenses?".

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

What alternative solutions did you explore? (Optional)

NA

@robertjchen robertjchen added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment DeployBlocker Indicates it should block deploying the API Hourly KSv2 labels Jul 16, 2024
@bernhardoj
Copy link
Contributor

Proposal

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

Delete modal confirmation message text changes from "...this expense..." to "...these expenses..." when closing the modal.

What is the root cause of that problem?

The title depends on the selected item to delete count.

<ConfirmModal
isVisible={deleteExpensesConfirmModalVisible}
onConfirm={handleDeleteExpenses}
onCancel={handleOnCancelConfirmModal}
title={translate('iou.deleteExpense', {count: selectedItemsToDelete.length})}
prompt={translate('iou.deleteConfirmation', {count: selectedItemsToDelete.length})}

When we press Cancel, it will clear the selected item to delete and set the modal visibility to false.

const handleOnCancelConfirmModal = () => {
setSelectedItemsToDelete([]);
setDeleteExpensesConfirmModalVisible(false);
};

This makes the selected item to delete count become 0 and the plural form is used while the modal is still animating to close.

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

Clears the selected item to delete when the modal is fully hidden instead of cancelling the modal.

onModalHide={() => setSelectedItemsToDelete([])}

@melvin-bot melvin-bot bot added the Overdue label Jul 18, 2024
Copy link

melvin-bot bot commented Jul 19, 2024

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

@robertjchen robertjchen added the External Added to denote the issue can be worked on by a contributor label Jul 22, 2024
Copy link

melvin-bot bot commented Jul 22, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01086f676b97015a4f

@melvin-bot melvin-bot bot changed the title Search - Delete modal message changes to ".. these expenses" briefly when clicking Cancel [$250] Search - Delete modal message changes to ".. these expenses" briefly when clicking Cancel Jul 22, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 22, 2024
Copy link

melvin-bot bot commented Jul 22, 2024

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

@abdulrahuman5196
Copy link
Contributor

@bernhardoj 's proposal here #45447 (comment) looks good and works well. Using onModalHide is better compared to other proposals.

🎀 👀 🎀
C+ Reviewed
@robertjchen

Copy link

melvin-bot bot commented Jul 24, 2024

Current assignee @robertjchen is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@tienifr
Copy link
Contributor

tienifr commented Jul 24, 2024

I tried to add onModalHide={() => setSelectedItemsToDelete([])} to


but the bug can be reproduced:

Screen.Recording.2024-07-24.at.17.34.09.mov

@bernhardoj Can you help confirm if your solution works well.

@bernhardoj
Copy link
Contributor

Yes, it works well.

web.mp4

Pretty sure @abdulrahuman5196 have tested it too.

@tienifr

This comment was marked as outdated.

@tienifr
Copy link
Contributor

tienifr commented Jul 24, 2024

@bernhardoj Ah, I got it, after trying to refresh the browser a few times, your solution works from my side.

@robertjchen
Copy link
Contributor

Sounds good, thanks for testing- let's go with @bernhardoj 's proposal 👍

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 24, 2024
Copy link

melvin-bot bot commented Jul 24, 2024

📣 @abdulrahuman5196 🎉 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

@bernhardoj
Copy link
Contributor

PR is ready

cc: @abdulrahuman5196

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Aug 7, 2024
@melvin-bot melvin-bot bot changed the title [$250] Search - Delete modal message changes to ".. these expenses" briefly when clicking Cancel [HOLD for payment 2024-08-14] [$250] Search - Delete modal message changes to ".. these expenses" briefly when clicking Cancel Aug 7, 2024
Copy link

melvin-bot bot commented Aug 7, 2024

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 7, 2024
Copy link

melvin-bot bot commented Aug 7, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.17-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 2024-08-14. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Aug 7, 2024

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:

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

@abdulrahuman5196
Copy link
Contributor

The PR that introduced the bug has been identified. Link to the PR:
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:
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://github.com/Expensify/App/pull/45143/files#r1717120388

Determine if we should create a regression test for this bug.

Yes.

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. Open Search page
  2. Click on the checkbox next to one of the expenses (one only, important)
  3. Click on the dropdown
  4. Click Delete
  5. Note that the confirmation message is "Are you sure that you want to delete this expense?"
  6. Click Cancel
  7. Verify the confirmation message doesn't change to "Are you sure that you want to delete these expenses?"

@slafortune
Copy link
Contributor

@abdulrahuman5196 Role C+ is due payment through NewDot Manual Requests - $250
@bernhardoj Role Contributor requires payment through NewDot Manual Requests - $250

@JmillsExpensify
Copy link

$250 approved for @abdulrahuman5196

@bernhardoj
Copy link
Contributor

Requested in ND.

@JmillsExpensify
Copy link

$250 approved for @bernhardoj

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

9 participants