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-19] [$250] Search - Select mode remains with empty state screen after deleting all expenses #46374

Closed
3 of 6 tasks
lanitochka17 opened this issue Jul 27, 2024 · 29 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

@lanitochka17
Copy link

lanitochka17 commented Jul 27, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.0.13-3
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

Precondition:

  • There is only one unpaid expense and no other expeneses in the account
  1. Launch New Expensify app
  2. Go to Search
  3. Long press on the expense
  4. Tap Select
  5. Tap on the dropdown
  6. Tap Delete
  7. Delete the expense

Expected Result:

The select mode will exit because there is no more expense

Actual Result:

The select mode remains with empty state screen

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

Add any screenshot/video evidence

Bug6554769_1722093464748.Screen_Recording_20240727_231204_New_Expensify.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01cece455709af5d24
  • Upwork Job ID: 1818027569717051206
  • Last Price Increase: 2024-07-29
  • Automatic offers:
    • dominictb | Contributor | 103369346
Issue OwnerCurrent Issue Owner: @sakluger
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 27, 2024
Copy link

melvin-bot bot commented Jul 27, 2024

Triggered auto assignment to @sakluger (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.

@lanitochka17
Copy link
Author

We think that this bug might be related to #wave-collect - Release 1

@lanitochka17
Copy link
Author

@sakluger FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@nyomanjyotisa
Copy link
Contributor

Proposal

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

Select mode remains with empty state screen after deleting all expenses

What is the root cause of that problem?

We don't set isMobileSelectionModeActive to false if shouldShowEmptyState here

if (shouldShowEmptyState) {
return (
<>
<SearchPageHeader
status={status}
hash={hash}
/>
<EmptySearchView />
</>
);
}

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

set isMobileSelectionModeActive to false if shouldShowEmptyState

    if (shouldShowEmptyState) {
        setIsMobileSelectionModeActive?.(false);

        return (
            <>
                <SearchPageHeader
                    status={status}
                    hash={hash}
                />
                <EmptySearchView />
            </>
        );
    }

RESULT

-1-New-Expensify.11.mp4

What alternative solutions did you explore? (Optional)

@cretadn22
Copy link
Contributor

Proposal

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

Select mode remains with empty state screen after deleting all expenses

What is the root cause of that problem?

When all expenses are deleted, isMobileSelectionModeActive remain true, causing the "selectMultiple" title to still be shown

{!isMobileSelectionModeActive && queryJSON ? (
<>
<TopBar
activeWorkspaceID={policyIDs}
breadcrumbLabel={translate('common.search')}
shouldDisplaySearch={false}
/>
<SearchStatusMenu status={queryJSON.status} />
</>
) : (
<HeaderWithBackButton
title={translate('search.selectMultiple')}
onBackButtonPress={() => setIsMobileSelectionModeActive(false)}
/>

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

This is the logic for showing an empty view modal

if (shouldShowEmptyState) {
return (
<>
<SearchPageHeader
status={status}
hash={hash}
/>
<EmptySearchView />
</>
);
}

If shouldShowEmptyState is true, we should set isMobileSelectionModeActive to false and we should display only the EmptySearchView component. This is because, in this case, we won’t pass isMobileSelectionModeActive to the SearchPageHeader component, which will then return null.

    if (shouldShowEmptyState) {
        setIsMobileSelectionModeActive?.(false);
        return (
                <EmptySearchView />
        );
    }

Removing the redundant SearchPageHeader component is important because it enhances performance (especially on mobile) and reduces errors in the logs

What alternative solutions did you explore? (Optional)

@dominictb
Copy link
Contributor

dominictb commented Jul 29, 2024

Proposal

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

The select mode remains with empty state screen

What is the root cause of that problem?

When deleting any expenses, we don't set isMobileSelectionModeActive to false:

onSelected: () => {
if (isOffline) {
setOfflineModalOpen?.();
return;
}
onSelectDeleteOption?.(selectedTransactionsKeys);
},

like we did in Hold and Unhold option:
setIsMobileSelectionModeActive?.(false);

setIsMobileSelectionModeActive?.(false);

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

We should use

                    if (isMobileSelectionModeActive) {
                        setIsMobileSelectionModeActive?.(false);
                    }

when deleting selected expenses as well.

What alternative solutions did you explore? (Optional)

We can use

    const isSearchResultsEmpty = !searchResults || SearchUtils.isSearchResultsEmpty(searchResults);
    const prevIsSearchResultEmpty = usePrevious(isSearchResultsEmpty);

    useEffect(() => {
        if (isSearchResultsEmpty && !prevIsSearchResultEmpty) {
            setIsMobileSelectionModeActive?.(false);
        }
    }, [isSearchResultsEmpty, prevIsSearchResultEmpty, setIsMobileSelectionModeActive]);

in this page. It will call setIsMobileSelectionModeActive?.(false) once the search result changes from true to false.

@sakluger sakluger added the External Added to denote the issue can be worked on by a contributor label Jul 29, 2024
@melvin-bot melvin-bot bot changed the title Search - Select mode remains with empty state screen after deleting all expenses [$250] Search - Select mode remains with empty state screen after deleting all expenses Jul 29, 2024
Copy link

melvin-bot bot commented Jul 29, 2024

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

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

melvin-bot bot commented Jul 29, 2024

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

@hungvu193
Copy link
Contributor

hungvu193 commented Jul 30, 2024

Thanks for the proposals everyone!

@nyomanjyotisa @cretadn22 I don't think updating a state inside a render statement is a good way to handle this issue.

@dominictb 's alternative proposal here looks good to me!

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Jul 30, 2024

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

@hungvu193
Copy link
Contributor

Sorry for the notification, found a bug while testing selected proposal, I withdraw my previous decision.

@dominictb
Copy link
Contributor

Proposal updated

Updated the code changes in the alternative solution

@dominictb
Copy link
Contributor

@hungvu193 I have updated the code changes in my alternative solution to make it easier for you to test. The general idea remains the same.

@hungvu193
Copy link
Contributor

I was about to ask you for more information. Thanks, will test it shortly

@hungvu193 I have updated the code changes in my alternative solution to make it easier for you to test. The general idea remains the same.

@hungvu193
Copy link
Contributor

All good. Let's go with @dominictb 's alternative proposal. cc @NikkiWines

@cretadn22
Copy link
Contributor

cretadn22 commented Jul 30, 2024

If shouldShowEmptyState is true, we should set isMobileSelectionModeActive to false and we should display only the EmptySearchView component. This is because, in this case, we won’t pass isMobileSelectionModeActive to the SearchPageHeader component, which will then return null.

if (shouldShowEmptyState) {
    setIsMobileSelectionModeActive?.(false);
    return (
            <EmptySearchView />
    );
}

Removing the redundant SearchPageHeader component is important because it enhances performance (especially on mobile) and reduces errors in the logs

@hungvu193 @dominictb I discover an improvement point. Let's include it in the PR phase

@sakluger
Copy link
Contributor

sakluger commented Aug 1, 2024

@hungvu193 - does @cretadn22's comment impact your recommendation?

@melvin-bot melvin-bot bot added the Overdue label Aug 1, 2024
@hungvu193
Copy link
Contributor

@hungvu193 - does @cretadn22's comment impact your recommendation?

No. I'll still keep my decision. Please assign @dominictb @NikkiWines

@melvin-bot melvin-bot bot removed the Overdue label Aug 2, 2024
@NikkiWines
Copy link
Contributor

Yep @dominictb's alt proposal looks good 👍

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

melvin-bot bot commented Aug 2, 2024

📣 @dominictb 🎉 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 melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Aug 5, 2024
@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 12, 2024
@melvin-bot melvin-bot bot changed the title [$250] Search - Select mode remains with empty state screen after deleting all expenses [HOLD for payment 2024-08-19] [$250] Search - Select mode remains with empty state screen after deleting all expenses Aug 12, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 12, 2024
Copy link

melvin-bot bot commented Aug 12, 2024

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

Copy link

melvin-bot bot commented Aug 12, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.18-10 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-19. 🎊

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

Copy link

melvin-bot bot commented Aug 12, 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:

  • [@hungvu193] The PR that introduced the bug has been identified. Link to the PR:
  • [@hungvu193] 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:
  • [@hungvu193] 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:
  • [@hungvu193] Determine if we should create a regression test for this bug.
  • [@hungvu193] 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.
  • [@sakluger] 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 Aug 18, 2024
@hungvu193
Copy link
Contributor

hungvu193 commented Aug 19, 2024

  • The PR that introduced the bug has been identified. Link to the PR: [Search v1] Add bulk actions #44385
  • 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: N/A
  • 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: N/A
  • Determine if we should create a regression test for this bug: No.

This is a new feature that we added recently and still under development I believe so I don't think we need regression test for this one.

@sakluger
Copy link
Contributor

Thanks @hungvu193. Could you please write out the proposed regression test steps?

@melvin-bot melvin-bot bot removed the Overdue label Aug 19, 2024
@sakluger
Copy link
Contributor

Summarizing payment on this issue:

Contributor: @dominictb $250, paid via Upwork
Contributor+: @hungvu193 $250, please request on Newdot

@hungvu193
Copy link
Contributor

Thanks @hungvu193. Could you please write out the proposed regression test steps?

My bad, I updated the checklist

@sakluger
Copy link
Contributor

Ah, that makes more sense. Thanks!

@JmillsExpensify
Copy link

$250 approved for @hungvu193

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
No open projects
Status: Done
Development

No branches or pull requests

8 participants