Skip to content

[Due for payment 2025-05-28] [$250] Expense-On deleting expense, header displays "expense" #61288

Closed

Description

@mitarachim

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: V9 1.39-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/6034865
Email or phone of affected tester (no customers): Slottwo1 la@gmail.com
Issue reported by: Applause Internal Team
Device used: Redminote note 10s android 13
App Component: Money Requests

Action Performed:

  1. Launch app
  2. Open workspace chat
  3. Create two manual expenses
  4. Open the second expense
  5. Send a message
  6. Tap header - delete the expense
  7. Note header displays "expense"
  8. Tap sublink in header and go back to expense report page
  9. Tap reply thread of "deleted expense"
  10. Now note header displays deleted expense

Expected Result:

On deleting expense, header must display "deleted expense".

Actual Result:

On deleting expense, header displays "expense"and on revisit only it displays "deleted expense".

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6818985_1746136907181.Screenrecorder-2025-05-02-03-25-20-615.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021919848678013167581
  • Upwork Job ID: 1919848678013167581
  • Last Price Increase: 2025-05-06
Issue OwnerCurrent Issue Owner: @zanyrenney

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 2, 2025
  2. melvin-bot commented on May 2, 2025

    @melvin-bot

    Triggered auto assignment to @zanyrenney (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. dmkt9 commented on May 2, 2025

    @dmkt9
    Contributor

    Proposal

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

    On deleting expense, header displays "expense"and on revisit only it displays "deleted expense".

    What is the root cause of that problem?

    • The transaction name is derived from parentReportAction, which relies on the global variable allReportActions:
      formattedName = getTransactionReportName({reportAction: parentReportAction, transactions, reports});
    • The parentReportAction variable is assigned here:

      App/src/libs/ReportUtils.ts

      Lines 4644 to 4649 in 5da3afa

      let parentReportAction: OnyxEntry<ReportAction>;
      if (parentReportActionParam) {
      parentReportAction = parentReportActionParam;
      } else {
      parentReportAction = isThread(report) ? allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.parentReportID}`]?.[report.parentReportActionID] : undefined;
      }

      App/src/libs/ReportUtils.ts

      Lines 964 to 974 in 5da3afa

      let allReportActions: OnyxCollection<ReportActions>;
      Onyx.connect({
      key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
      waitForCollectionCallback: true,
      callback: (actions) => {
      if (!actions) {
      return;
      }
      allReportActions = actions;
      },
      });

    A race condition occurs because the global allReportActions variable is updated after the AvatarWithDisplayName component finishes re-rendering post-deletion. This causes stale data to persist in the UI.

    function AvatarWithDisplayName({policy, report, isAnonymous = false, size = CONST.AVATAR_SIZE.DEFAULT, shouldEnableDetailPageNavigation = false}: AvatarWithDisplayNameProps) {
    const [parentReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.parentReportID}`, {canEvict: false});
    const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST) ?? CONST.EMPTY_OBJECT;
    const theme = useTheme();
    const styles = useThemeStyles();
    const StyleUtils = useStyleUtils();
    const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`);
    const [invoiceReceiverPolicy] = useOnyx(
    `${ONYXKEYS.COLLECTION.POLICY}${parentReport?.invoiceReceiver && 'policyID' in parentReport.invoiceReceiver ? parentReport.invoiceReceiver.policyID : CONST.DEFAULT_NUMBER_ID}`,
    );
    const title = getReportName(report, undefined, undefined, undefined, invoiceReceiverPolicy);

    What changes do we need to make to resolve the problem?

    • Instead of relying solely on the global allReportActions, use the parentReportActionParam parameter passed to getReportName to ensure synchronization with the latest data.
    • Update the implementation to explicitly pass parentReportActionParam to the function:
    const parentReportActionParam = report?.parentReportActionID ? parentReportActions?.[report.parentReportActionID] : undefined;  
    const title = getReportName(report, undefined, parentReportActionParam, undefined, invoiceReceiverPolicy);  

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

    Validate that UI components do not depend on global variables prone to race conditions.

    What alternative solutions did you explore? (Optional)

    N/A

    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.

  4. melvin-bot commented on May 5, 2025

    @melvin-bot

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

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on May 6, 2025
  6. changed the title [-]Expense-On deleting expense, header displays "expense"[/-] [+][$250] Expense-On deleting expense, header displays "expense"[/+] on May 6, 2025
  7. melvin-bot commented on May 6, 2025

    @melvin-bot
  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on May 6, 2025
  9. melvin-bot commented on May 6, 2025

    @melvin-bot

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

  10. zanyrenney commented on May 6, 2025

    @zanyrenney
    Contributor

    few proposals already -- @sobitneupane please can you review? thanks!

  11. 20 remaining items

  12. zanyrenney commented on May 29, 2025

    @zanyrenney
    Contributor

    Hey @sobitneupane please can you complete the checklist above so I can proceed with payment?

  13. zanyrenney commented on May 29, 2025

    @zanyrenney
    Contributor

    Also @dmkt9 please can you send me your upwork profile?

    Thanks both!

  14. dmkt9 commented on May 29, 2025

    @dmkt9
    Contributor
  15. sobitneupane commented on May 29, 2025

    @sobitneupane
    Contributor

    Sorry for the delay, @zanyrenney .

    I’m not at full capacity this week, but I’ll try to get it done over the weekend.

  16. zanyrenney commented on May 30, 2025

    @zanyrenney
    Contributor

    Have sent you the job offer @dmkt9

  17. zanyrenney commented on May 30, 2025

    @zanyrenney
    Contributor

    Thanks for the update @sobitneupane , hopefully can get this closed out ASAP.

  18. dmkt9 commented on May 31, 2025

    @dmkt9
    Contributor

    Have sent you the job offer @dmkt9

    Yes. Thank you

  19. rafecolton commented on Jun 3, 2025

    @rafecolton
    Member

    Looks like this will be paid out soon

  20. sobitneupane commented on Jun 3, 2025

    @sobitneupane
    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: Track Expense flow #37282

    • [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:

    • [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. Launch app
    2. Open workspace chat
    3. Create two manual expenses
    4. Open the second expense
    5. Send a message
    6. Tap header - delete the expense
    7. Verify that header displays "deleted expense"

    Do we agree 👍 or 👎

  21. zanyrenney commented on Jun 3, 2025

    @zanyrenney
    Contributor

    payment summary

    $250 paid to @dmkt9 for the contributor role (Paid via upwork)
    $250 owed to @sobitneupane for the contributor plus role (please request on ND)

  22. laurenreidexpensify commented on Aug 7, 2025

    @laurenreidexpensify
    Contributor

    $250 approved in New Expensify for @sobitneupane

  23. trjExpensify commented on Aug 14, 2025

    @trjExpensify
    Contributor

    $250 approved in NewDot for @sobitneupane.

    (We changed approvers so this bounced to me!)

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

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions