Skip to content

[Due for payment 2025-09-17] [Due for payment 2025-09-16] [$250] Reports - Details of last created expense, are not seen on preview on "Submit" while offline #68827

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: 9.1.97-1
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://test-management.browserstack.com/projects/2219752/test-runs/TR-352/folder/13176922/41237518/849028398
Email or phone of affected tester (no customers): ibellicotest+1626@gmail.com
Issue reported by: Applause Internal Team
Device used: Motorola MotoG60 / Android 12 / Chrome ( mWeb / Hybrid app) - Windows 10 / Chrome
App Component: Search

Action Performed:

Prerequisite: Account has at least one workspace created.
Prerequisite 2: Delayed submissions enabled.
Prerequisite 3: No expenses with "Draft" status.

  1. Open the Expensify app.
  2. Navigate to "Reports"
  3. Navigate to "Submit" if not already on that section.
  4. Turn off internet connection.
  5. Tap on "Create Report"
  6. Add a manual expense to report.
  7. Return to "Reports"
  8. Note that the new created report shows total amount, but a "This report has no expenses" message is seen instead of the expense details.
  9. Tap on FAB and select "Create Expense"
  10. Create a new manual expense and submit it to the same workspace and report.
  11. Note that now, details of the second expense appear, but the details of the first created one, are not seen yet.

Expected Result:

When creating a new expense while offline on "Submit" section, the expense details should be automatically seen on report preview.

Actual Result:

When creating the first expense on report while offline on “Submit”, a "This report has no expenses" message can be seen, and when creating a second expense, total amount updates, but only the details of the second expense appear. Details of first expense doesn’t appear yet.

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

Bug6921662_1755671736838.Last.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021958158813749221737
  • Upwork Job ID: 1958158813749221737
  • Last Price Increase: 2025-08-20
  • Automatic offers:
    • mkzie2 | Contributor | 108535626
Issue OwnerCurrent Issue Owner: @parasharrajat

Activity

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

    @melvin-bot

    Triggered auto assignment to @laurenreidexpensify (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. mkzie2 commented on Aug 20, 2025

    @mkzie2
    Contributor

    Proposal

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

    When creating the first expense on report while offline on “Submit”, a "This report has no expenses" message can be seen, and when creating a second expense, total amount updates, but only the details of the second expense appear. Details of first expense doesn’t appear yet.

    What is the root cause of that problem?

    We check the list key from the data. If the transaction key is checked before the report key, the transaction is not added to the list of transactions of the report data because reportIDToTransactions[reportKey] is undefined.

    App/src/libs/SearchUIUtils.ts

    Lines 1373 to 1379 in 4d7d44a

    if (reportIDToTransactions[reportKey]?.transactions) {
    reportIDToTransactions[reportKey].transactions.push(transaction);
    reportIDToTransactions[reportKey].from = data.personalDetailsList[data?.[reportKey as ReportKey]?.accountID ?? CONST.DEFAULT_NUMBER_ID];
    } else if (reportIDToTransactions[reportKey]) {
    reportIDToTransactions[reportKey].transactions = [transaction];
    reportIDToTransactions[reportKey].from = data.personalDetailsList[data?.[reportKey as ReportKey]?.accountID ?? CONST.DEFAULT_NUMBER_ID];
    }

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

    We should re-order the list key to always check the report key first

    onst listKeys = Object.keys(data);
    const reportKeys = listKeys.filter(isReportEntry);
    const transactionKeys = listKeys.filter(isTransactionEntry);
    const orderedKeys = [...reportKeys, ...transactionKeys];
    
    for (const key of orderedKeys) {
    

    for (const key in data) {

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

    Update SearchUIUtils test to cover the case where the transaction key is above the report key

    What alternative solutions did you explore? (Optional)

    Or if reportIDToTransactions[reportKey] is undefined, assign this object as an empty object and update the transaction list

    else {
        reportIDToTransactions[reportKey] = {} as unknown as TransactionGroupListItemType;
        reportIDToTransactions[reportKey].transactions = [transaction];
        reportIDToTransactions[reportKey].from = data.personalDetailsList[data?.[reportKey as ReportKey]?.accountID ?? CONST.DEFAULT_NUMBER_ID];
    }
    

    App/src/libs/SearchUIUtils.ts

    Lines 1373 to 1379 in 4d7d44a

    if (reportIDToTransactions[reportKey]?.transactions) {
    reportIDToTransactions[reportKey].transactions.push(transaction);
    reportIDToTransactions[reportKey].from = data.personalDetailsList[data?.[reportKey as ReportKey]?.accountID ?? CONST.DEFAULT_NUMBER_ID];
    } else if (reportIDToTransactions[reportKey]) {
    reportIDToTransactions[reportKey].transactions = [transaction];
    reportIDToTransactions[reportKey].from = data.personalDetailsList[data?.[reportKey as ReportKey]?.accountID ?? CONST.DEFAULT_NUMBER_ID];
    }

    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. dmkt9 commented on Aug 20, 2025

    @dmkt9
    Contributor

    Proposal

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

    What is the root cause of that problem?

    Since in this case, if a transaction is processed before its corresponding report, reportIDToTransactions[reportKey] will be undefined, and the transaction won't be added to the list.

    App/src/libs/SearchUIUtils.ts

    Lines 1373 to 1379 in 9ce95b7

    if (reportIDToTransactions[reportKey]?.transactions) {
    reportIDToTransactions[reportKey].transactions.push(transaction);
    reportIDToTransactions[reportKey].from = data.personalDetailsList[data?.[reportKey as ReportKey]?.accountID ?? CONST.DEFAULT_NUMBER_ID];
    } else if (reportIDToTransactions[reportKey]) {
    reportIDToTransactions[reportKey].transactions = [transaction];
    reportIDToTransactions[reportKey].from = data.personalDetailsList[data?.[reportKey as ReportKey]?.accountID ?? CONST.DEFAULT_NUMBER_ID];
    }

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

    We need to refactor this logic to make the code more coherent and ensure all cases are properly handled.

    App/src/libs/SearchUIUtils.ts

    Lines 1373 to 1379 in 9ce95b7

    if (reportIDToTransactions[reportKey]?.transactions) {
    reportIDToTransactions[reportKey].transactions.push(transaction);
    reportIDToTransactions[reportKey].from = data.personalDetailsList[data?.[reportKey as ReportKey]?.accountID ?? CONST.DEFAULT_NUMBER_ID];
    } else if (reportIDToTransactions[reportKey]) {
    reportIDToTransactions[reportKey].transactions = [transaction];
    reportIDToTransactions[reportKey].from = data.personalDetailsList[data?.[reportKey as ReportKey]?.accountID ?? CONST.DEFAULT_NUMBER_ID];
    }

    const transactions = reportIDToTransactions[reportKey]?.transactions ?? [];
    transactions.push(transaction);
    reportIDToTransactions[reportKey] = {
        ...reportIDToTransactions[reportKey],
        transactions,
        from: data.personalDetailsList[data?.[reportKey as ReportKey]?.accountID ?? CONST.DEFAULT_NUMBER_ID],
    };

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

    Add tests for getReportSections.

    What alternative solutions did you explore? (Optional)

    NA

    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. changed the title [-]Reports - Details of last created expense, are not seen on preview on "Submit" while offline[/-] [+][$250] Reports - Details of last created expense, are not seen on preview on "Submit" while offline[/+] on Aug 20, 2025
  6. melvin-bot commented on Aug 20, 2025

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

    @melvin-bot

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

  9. parasharrajat commented on Aug 21, 2025

    @parasharrajat
    Member

    Both proposals have same root cause and technically solutions are just refactoring the code so I don't consider one syntax good over another. With this, I think we can go with the first proposal with correct idea.

    Thus we can go with @mkzie2's alternative solution as it simple change over reordering.

    🎀 👀 🎀 C+ reviewed

  10. melvin-bot commented on Aug 21, 2025

    @melvin-bot

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

  11. 44 remaining items

  12. mkzie2 commented on Sep 23, 2025

    @mkzie2
    Contributor

    @parasharrajat Sorry for the delay (it was a bit tricky to fix the regression). The PR is now ready for review

  13. laurenreidexpensify commented on Oct 3, 2025

    @laurenreidexpensify
    Contributor

    @parasharrajat bump for Review on the PR ^^ thanks

  14. parasharrajat commented on Oct 3, 2025

    @parasharrajat
    Member

    Sure, I will check that again. Thanks for the reminder

  15. laurenreidexpensify commented on Oct 20, 2025

    @laurenreidexpensify
    Contributor

    Looks like this was deployed to prod 7 days ago - #70181 (comment) - @parasharrajat are we good to proceed to payment?

  16. parasharrajat commented on Oct 20, 2025

    @parasharrajat
    Member

    @laurenreidexpensify yes it is done and ready for payment.

  17. parasharrajat commented on Oct 20, 2025

    @parasharrajat
    Member

    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: [No QA][Search v1] Create ReportListItem #42410 (comment)

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

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

    Precondition:

    • Account has at least one workspace created.
    • Delayed submissions enabled.
    • No expenses with "Draft" status.

    Test:

    1. Navigate to "Reports"
    2. Navigate to "Submit" if not already on that section.
    3. Turn off internet connection.
    4. Tap on "Create Report"
    5. Add a manual expense to report.
    6. Return to "Reports"
    7. Expected Result:
    8. The expense details should be automatically seen on report preview.

    Do we agree 👍 or 👎

  18. laurenreidexpensify commented on Oct 20, 2025

    @laurenreidexpensify
    Contributor

    Paymnet Summary

  19. parasharrajat commented on Nov 9, 2025

    @parasharrajat
    Member

    Payment requested as per #68827 (comment)

  20. trjExpensify commented on Nov 17, 2025

    @trjExpensify
    Contributor

    approved $250 for @parasharrajat.

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in review

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions