Skip to content

[HOLD for payment 2025-01-02] [$250] Search - App redirects to DM when submitting expense in Search after deleting expense #52477

Closed

Description

@IuliiaHerets

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.61-0
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers): applausetester+odijd0349@applause.expensifail.com
Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Open DM with any user.
  3. Submit an expense to the user.
  4. Go to Search.
  5. Select the expense via checkbox.
  6. Click on the dropdown > Delete expense.
  7. Delete the expense.
  8. Open FAB while stay on Search page.
  9. Click Submit expense under Quick action.
  10. Enter amount and submit it.
  11. Note that app redirects to DM with the user.
  12. Go to Search page.
  13. Open FAB > Click Submit expense under Quick action.
  14. Enter amount and submit it.
  15. Note that app stays in Search page in this case (expected result).

Expected Result:

In Step 11, app should remain in Search page when submitting expense to user after deleting an expense in Search.

Actual Result:

In Step 11, app redirects to DM when submitting expense to user after deleting an expense in Search.

This issue also happens with Submit expense option in FAB, and only happens when an expense is deleted in Search and submitting another expense.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6663547_1731490307345.20241113_172050.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021861529064896018849
  • Upwork Job ID: 1861529064896018849
  • Last Price Increase: 2024-11-26
  • Automatic offers:
    • DylanDylann | Reviewer | 105296071
    • FitseTLT | Contributor | 105296073
Issue OwnerCurrent Issue Owner: @abekkala

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Nov 13, 2024
  2. melvin-bot commented on Nov 13, 2024

    @melvin-bot

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

  3. FitseTLT commented on Nov 13, 2024

    @FitseTLT
    Contributor

    Edited by proposal-police: This proposal was edited at 2024-11-13 14:46:43 UTC.

    Proposal

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

    Search - App redirects to DM when submitting expense in Search after deleting expense
    To reproduce:
    Make sure you have an empty chat with someone (by creating an expense and deleting it so that it will appear in quick action menu in FAB)
    then open search and create the expense from Quick action menu

    What is the root cause of that problem?

    When we notifyNewAction when creating the expense scrollToBottomForCurrentUserAction is called and if the lastVisibleActionCreated timestamp differs from the lastAction.created, which would mean the report action list doesn't have newest report action, we navigate to the report so as to fetch the newest report action by triggering openReport

    Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.reportID));

    Although we correctly update the lastVisibleActionCreated and lastAction this code is executed too quickly and by that time we don't have the correct updated values for both. So if we had any report action in the report then both values would be the same old values but as they will be equal this navigate code is not called (that's why we don't reproduce it on non-empty chats) but if we have a empty report before creating the expense the lastVisibleActionCreated will have a different value than the lastAction.created which is the created action.
    BTW this navigate code is unnecessarily being called even when you submit expense from the report screen, the effect only became visible for this current issue because we were in search page.

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

    We need to give it a time before scrollToBottomForCurrentUserAction is called so that we calculate according to the correct values of lastVisibleActionCreated and lastAction are populated by onyx. This will fix the problem from the root cause.

    const unsubscribe = Report.subscribeToNewActionEvent(report.reportID, scrollToBottomForCurrentUserAction);

            const unsubscribe = Report.subscribeToNewActionEvent(report.reportID, () => InteractionManager.runAfterInteractions(scrollToBottomForCurrentUserAction));
    
    

    _This root cause should be fixed but in parallel to that we can avoid notifying new Action when isSearchTopmostCentralPane() just the same as we are avoiding navigating to the report for the case search page is the active central pane

    App/src/libs/actions/IOU.ts

    Lines 3684 to 3685 in 4d9be4e

    if (activeReportID) {
    Report.notifyNewAction(activeReportID, payeeAccountID);

    But we should do the same change in other cases such as sendInvoice trackExpense splitBill here createDistanceRequest ... cases in IOU.ts too. Or centralize the check inside Report.notifyNewAction

    What alternative solutions did you explore? (Optional)

    As need to check if the current report screen is focused before executing it

    if (!hasNewestReportActionRef.current) {

                if (!hasNewestReportActionRef.current || !isFocused) {
    
    

    but if we don't want the scrollToBottom to be called we can add it here

    if (!isFromCurrentUser) {

                if (!isFromCurrentUser || !isFocused) {
    
    
  4. gijoe0295 commented on Nov 13, 2024

    @gijoe0295
    Contributor

    Proposal

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

    In Step 11, app redirects to DM when submitting expense to user after deleting an expense in Search.

    What is the root cause of that problem?

    We call notifyNewAction when completing the request:

    Report.notifyNewAction(activeReportID, payeeAccountID);

    In the new action event listener, we navigate to the DM report

    Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.reportID));

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

    If the topmost central pane screen is SearchCentralPane, we wouldn't need to call notifyNewAction.

  5. FitseTLT commented on Nov 13, 2024

    @FitseTLT
    Contributor
  6. melvin-bot commented on Nov 19, 2024

    @melvin-bot

    @abekkala Huh... This is 4 days overdue. Who can take care of this?

  7. melvin-bot commented on Nov 21, 2024

    @melvin-bot

    @abekkala Still overdue 6 days?! Let's take care of this!

  8. melvin-bot commented on Nov 25, 2024

    @melvin-bot

    @abekkala 10 days overdue. Is anyone even seeing these? Hello?

  9. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Nov 26, 2024
  10. changed the title [-]Search - App redirects to DM when submitting expense in Search after deleting expense[/-] [+][$250] Search - App redirects to DM when submitting expense in Search after deleting expense[/+] on Nov 26, 2024
  11. melvin-bot commented on Nov 26, 2024

    @melvin-bot
  12. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Nov 26, 2024
  13. 54 remaining items

  14. changed the title [-][$250] Search - App redirects to DM when submitting expense in Search after deleting expense[/-] [+][HOLD for payment 2025-01-02] [$250] Search - App redirects to DM when submitting expense in Search after deleting expense[/+] on Dec 26, 2024
  15. melvin-bot commented on Dec 26, 2024

    @melvin-bot

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

  16. melvin-bot commented on Dec 26, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.78-6 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 2025-01-02. 🎊

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

  17. melvin-bot commented on Dec 26, 2024

    @melvin-bot

    @DylanDylann @abekkala @DylanDylann The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  18. moved this from Bugs and Follow Up Issues to Hold for Payment in #expensify-bugson Dec 31, 2024
  19. abekkala commented on Jan 6, 2025

    @abekkala
    Contributor

    @DylanDylann can you complete the checklist above?

  20. DylanDylann commented on Jan 7, 2025

    @DylanDylann
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] 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: NA

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: NA

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Test:

    1. Open DM with any user.
    2. Submit an expense to the user.
    3. Go to Search.
    4. Select the expense via checkbox.
    5. Click on the dropdown > Delete expense.
    6. Delete the expense.
    7. Open FAB while stay on Search page.
    8. Click Submit expense under Quick action.
    9. Enter amount and submit it.
    10. Verify that app stays in Search page.

    Do we agree 👍 or 👎

  21. abekkala commented on Jan 7, 2025

    @abekkala
    Contributor

    @FitseTLT and @DylanDylann payments sent and contracts ended - thank you! 🎉

  22. moved this from Hold for Payment to Done in #expensify-bugson Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions