Skip to content

Reports -"Create Expense" button doesn´t appear on empty state screen when deleting expenses #61344

Closed

Description

@lanitochka17

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.1.39-2
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): ibellicotest+648@gmail.com
Issue reported by: Applause - Internal Team

Action Performed:

  1. Open the staging.new.expensify.com website
  2. Open any workspace chat
  3. Submit a few manual expenses. (At least two)
  4. Navigate to "Reports"
  5. Long tap on any expense and tap on "Select"
  6. Select all the expenses
  7. Tap on the dropdown menu and delete them
  8. Note that an empty state modal appears
  9. Note that "Create Expense" button is not displayed in it

Expected Result:

"Create Expense" button should appear automatically on empty state screen on "Reports" after deleting all the expenses

Actual Result:

When all the expenses are deleted on "Reports" section, "Create Expense" button is not automatically displayed on "You haven´t created any expense yet" modal

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop
Platforms Tested: On which of our officially supported platforms was this issue tested:
  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6819792_1746205558853.Empty.mp4

View all open jobs on GitHub

Activity

  1. melvin-bot commented on May 2, 2025

    @melvin-bot

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

  2. melvin-bot commented on May 2, 2025

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  3. github-actions commented on May 2, 2025

    @github-actions
    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.
  4. samranahm commented on May 2, 2025

    @samranahm
    Contributor

    Proposal

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

    Create Expense" button doesn't appear on empty state screen when deleting expenses

    What is the root cause of that problem?

    This happen because currently we did not display button on default case here

    return {
    headerMedia: LottieAnimations.GenericEmptyState,
    title: translate('search.searchResults.emptyResults.title'),
    subtitle: translate('search.searchResults.emptyResults.subtitle'),
    headerContentStyles: [styles.emptyStateFolderWebStyles, StyleUtils.getBackgroundColorStyle(theme.emptyFolderBG)],
    lottieWebViewStyles: {backgroundColor: theme.emptyFolderBG, ...styles.emptyStateFolderWebStyles},
    };

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

    We should add

    buttons: [
    ...(!hasSeenTour
    ? [
    {
    buttonText: translate('emptySearchView.takeATestDrive'),
    buttonAction: () => {
    openExternalLink(navatticURL);
    setSelfTourViewed();
    if (viewTourTaskReport && canModifyTheTask && canActionTheTask) {
    completeTask(viewTourTaskReport);
    }
    },
    },
    ]
    : []),
    {
    buttonText: translate('iou.createExpense'),
    buttonAction: () =>
    interceptAnonymousUser(() => {
    if (shouldRedirectToExpensifyClassic) {
    setModalVisible(true);
    return;
    }
    startMoneyRequest(CONST.IOU.TYPE.CREATE, generateReportID());
    }),
    success: true,
    },
    ],

    these buttons on default case too

    here

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  5. ChavdaSachin commented on May 2, 2025

    @ChavdaSachin
    Contributor

    Is it open of external?

  6. MarioExpensify commented on May 2, 2025

    @MarioExpensify
    Contributor

    @ChavdaSachin not yet, trying to find that PR caused the regression.

  7. MarioExpensify commented on May 2, 2025

    @MarioExpensify
    Contributor

    Reverting this PR solved the issue. A revert PR is already on its way here.

    CC: @martasudol @c3024 @MariaHCD @mountiny

  8. ChavdaSachin commented on May 2, 2025

    @ChavdaSachin
    Contributor

    Proposal

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

    Reports -"Create Expense" button doesn´t appear on empty state screen when deleting expenses

    What is the root cause of that problem?

    following PR optimizes the search call which caused the regression
    https://github.com/Expensify/App/pull/60896/files

    Previously when user deletes a transaction - it used to trigger a search call which would return value of hasResults = false if all the transactions are deleted.
    But after this PR, it does not trigger a search call and relies on snapshot when user deletes a transaction and hence the old copy of search results has value hasResults = true and hence default case is loaded here instead of case CONST.SEARCH.DATA_TYPES.EXPENSE.

    if (!hasResults) {

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

    There are 2 possible solutions to this issue.

    1. Trigger a search call when user deletes a transaction.

    To archive that - modify following condition to compare only the length of TransactionIDs array and trigger a search call in case it does not match(it ensures both case - new ID and deletion)

    const hasNewTransactions = currentTransactionIDs.length > previousTransactionIDs.length && currentTransactionIDs.some((id) => !previousTransactionIDs.includes(id));
    if (hasNewTransactions) {

            const hasChangeInTransactions = currentTransactionIDs.length !== previousTransactionIDs.length ;
            if (hasChangeInTransactions) {
                search({queryJSON, offset: 0});
            }
    1. Remove !hasResults check form following places.
      if (!hasResults) {

      if (!hasResults) {

    Explaination: why we don't want that check?
    coz we would render emptySearchView only when there are no results to show, so we don't really need an extra condition here

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    NA

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  9. ChavdaSachin commented on May 2, 2025

    @ChavdaSachin
    Contributor

    @MarioExpensify could you maybe take a look at my solution 2 in this proposal
    I could explain it further if you want.

    I could raise a quick PR and we might not need this revert.

  10. MarioExpensify commented on May 2, 2025

    @MarioExpensify
    Contributor

    @ChavdaSachin as this was a regression from another PR we'll leave it to be fixed by the original author. Thank you for your proposal.

  11. MarioExpensify commented on May 2, 2025

    @MarioExpensify
    Contributor

    Fixed in staging after revert CP'ed.

  12. 5 remaining items

  13. MarioExpensify commented on May 7, 2025

    @MarioExpensify
    Contributor

    @martasudol any news on this one?

  14. c3024 commented on May 7, 2025

    @c3024
    Contributor

    The PR that caused this was reverted. This issue can be closed.

  15. c3024 commented on May 7, 2025

    @c3024
    Contributor

    This new PR works well with this issue too.

  16. MarioExpensify commented on May 7, 2025

    @MarioExpensify
    Contributor

    Awesome @lanitochka17 can you retest so we close this one?

  17. melvin-bot commented on May 13, 2025

    @melvin-bot

    @MarioExpensify Eep! 4 days overdue now. Issues have feelings too...

  18. MarioExpensify commented on May 13, 2025

    @MarioExpensify
    Contributor

    Requested re-test here.

  19. m-natarajan commented on May 13, 2025

    @m-natarajan

    Issue not reproducible

    screen-20250513-164455.mp4
  20. MarioExpensify commented on May 13, 2025

    @MarioExpensify
    Contributor

    Thank you @m-natarajan, closing this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions