Skip to content

[$250] Expense preview- Report title part of report preview is blank briefly after submitting expense #59525

Closed as not planned

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.1.22-2
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: No, reproducible on hybrid only
If this was caught during regression testing, add the test name, ID and link from TestRail: Exp #58479
Email or phone of affected tester (no customers): applausetester+sdsoidsj@applause.expensifail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.3 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Log in with Expensifail account.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Submit a manual expense.
  4. Note that the report title part of the expense report preview is blank briefly.
  5. Click Submit.
  6. Go offline.
  7. Submit another manual expense.

Expected Result:

The report title part of the expense report preview should not be blank after submitting the expense.

Actual Result:

In offline mode, the report title part of the expense report preview is blank after submitting the expense.
In online mode, the same part is blank briefly after submitting the 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

Image https://github.com/user-attachments/assets/32aa7967-a8b9-48b8-bc88-31b2fddf27ed

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021907791019793338504
  • Upwork Job ID: 1907791019793338504
  • Last Price Increase: 2025-04-03
  • Automatic offers:
    • nkdengineer | Contributor | 106825210
Issue OwnerCurrent Issue Owner: @Beamanator

Activity

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

    @melvin-bot

    Triggered auto assignment to @isabelastisser (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. daledah commented on Apr 2, 2025

    @daledah
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-04-02 10:48:29 UTC.

    Proposal

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

    In offline mode, the report title part of the expense report preview is blank after submitting the expense.
    In online mode, the same part is blank briefly after submitting the expense.

    What is the root cause of that problem?

    We don't return the childReportName when we run buildOptimisticReportPreview to update Onyx data

    App/src/libs/ReportUtils.ts

    Lines 5953 to 5980 in 66f28d3

    return {
    reportActionID: reportActionID ?? rand64(),
    reportID: chatReport?.reportID,
    actionName: CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW,
    pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
    originalMessage: {
    linkedReportID: iouReport?.reportID,
    },
    message: [
    {
    html: message,
    text: message,
    isEdited: false,
    type: CONST.REPORT.MESSAGE.TYPE.COMMENT,
    },
    ],
    delegateAccountID: delegateAccountDetails?.accountID,
    created,
    accountID: iouReport?.managerID,
    // The preview is initially whispered if created with a receipt, so the actor is the current user as well
    actorAccountID: hasReceipt ? currentUserAccountID : reportActorAccountID,
    childReportID: childReportID ?? iouReport?.reportID,
    childMoneyRequestCount: 1,
    childLastActorAccountID: currentUserAccountID,
    childLastMoneyRequestComment: comment,
    childRecentReceiptTransactionIDs: hasReceipt && !isEmptyObject(transaction) && transaction?.transactionID ? {[transaction.transactionID]: created} : undefined,
    ...(isTestTransaction && {childStateNum: 2, childStatusNum: 4}),
    };

    It leads to action.childReportName being empty when creating an expense in offline

    <Text
    style={[styles.headerText]}
    testID="MoneyRequestReportPreview-reportName"
    >
    {action.childReportName}
    </Text>

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

    We have some ways to fix it as follows

    1. The simplest way is that we will not show this View when there is no childReportName

    2. We can add fallback here like 'Expense report'

    1. We will calculate and return additional childReportName in buildOptimisticReportPreview by using populateOptimisticReportFormula function
    • Create a new pattern in const.ts file DEFAULT_REPORT_ID_PATTERN: '{report:type} {report:reportID}'
    • Update function populateOptimisticReportFormula to match with DEFAULT_REPORT_ID_PATTERN here
            .replaceAll('{report:reportID}', report.reportID ?? '')
    
    • Return childReportName in buildOptimisticReportPreview function
        const childReportName = populateOptimisticReportFormula(CONST.POLICY.DEFAULT_REPORT_ID_PATTERN, iouReport, undefined);
    

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

    None

    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.

  4. nkdengineer commented on Apr 3, 2025

    @nkdengineer
    Contributor

    Proposal

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

    In offline mode, the report title part of the expense report preview is blank after submitting the expense.
    In online mode, the same part is blank briefly after submitting the expense.

    What is the root cause of that problem?

    We're displaying the report title in report preview from childReportName of REPORTPREVIEW action,

    <Text
    style={[styles.headerText]}
    testID="MoneyRequestReportPreview-reportName"
    >
    {action.childReportName}
    </Text>

    But childReportName is empty when we create optimistic data for REPORTPREVIEW action that leads the report title is empty briefly until the API is done.

    App/src/libs/ReportUtils.ts

    Lines 5953 to 5980 in 66f28d3

    return {
    reportActionID: reportActionID ?? rand64(),
    reportID: chatReport?.reportID,
    actionName: CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW,
    pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
    originalMessage: {
    linkedReportID: iouReport?.reportID,
    },
    message: [
    {
    html: message,
    text: message,
    isEdited: false,
    type: CONST.REPORT.MESSAGE.TYPE.COMMENT,
    },
    ],
    delegateAccountID: delegateAccountDetails?.accountID,
    created,
    accountID: iouReport?.managerID,
    // The preview is initially whispered if created with a receipt, so the actor is the current user as well
    actorAccountID: hasReceipt ? currentUserAccountID : reportActorAccountID,
    childReportID: childReportID ?? iouReport?.reportID,
    childMoneyRequestCount: 1,
    childLastActorAccountID: currentUserAccountID,
    childLastMoneyRequestComment: comment,
    childRecentReceiptTransactionIDs: hasReceipt && !isEmptyObject(transaction) && transaction?.transactionID ? {[transaction.transactionID]: created} : undefined,
    ...(isTestTransaction && {childStateNum: 2, childStatusNum: 4}),
    };

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

    1. Add childReportName as iouReport.reportName here
    childReportName: iouReport.reportName,
    

    App/src/libs/ReportUtils.ts

    Lines 5953 to 5980 in 66f28d3

    return {
    reportActionID: reportActionID ?? rand64(),
    reportID: chatReport?.reportID,
    actionName: CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW,
    pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
    originalMessage: {
    linkedReportID: iouReport?.reportID,
    },
    message: [
    {
    html: message,
    text: message,
    isEdited: false,
    type: CONST.REPORT.MESSAGE.TYPE.COMMENT,
    },
    ],
    delegateAccountID: delegateAccountDetails?.accountID,
    created,
    accountID: iouReport?.managerID,
    // The preview is initially whispered if created with a receipt, so the actor is the current user as well
    actorAccountID: hasReceipt ? currentUserAccountID : reportActorAccountID,
    childReportID: childReportID ?? iouReport?.reportID,
    childMoneyRequestCount: 1,
    childLastActorAccountID: currentUserAccountID,
    childLastMoneyRequestComment: comment,
    childRecentReceiptTransactionIDs: hasReceipt && !isEmptyObject(transaction) && transaction?.transactionID ? {[transaction.transactionID]: created} : undefined,
    ...(isTestTransaction && {childStateNum: 2, childStatusNum: 4}),
    };

    I noticed that we have an inconsistency for the expense report's reportName. The default report title formula is {report:type} {report:startdate}, and we used it to generate reportName in optimistic data here but the backend return the reportName with the formula is {report:type} {report:reportID}. We should fix it from backend side to change the default formula of the title field to {report:type} {report:reportID} or fix reportName of new expense report.

    Image
    1. The IOU report is displaying IOU, but this report has the custom report name in front-end; then we can use getReportName(iouReport) and fallback it to action.childReportName if iouReport data isn't available
    Image
    {getReportName(iouReport) || action.childReportName} 
    

    <Text
    style={[styles.headerText]}
    testID="MoneyRequestReportPreview-reportName"
    >
    {action.childReportName}
    </Text>

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

    Add a unit test for buildOptimisticReportPreview and verify that the childReportName is equal to iouReport.reportName.

    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. added
    ExternalAdded to denote the issue can be worked on by a contributor
    Help WantedApply this label when an issue is open to proposals by contributors
    on Apr 3, 2025
  6. changed the title [-]Expense preview- Report title part of report preview is blank briefly after submitting expense[/-] [+][$250] Expense preview- Report title part of report preview is blank briefly after submitting expense[/+] on Apr 3, 2025
  7. melvin-bot commented on Apr 3, 2025

    @melvin-bot
  8. melvin-bot commented on Apr 3, 2025

    @melvin-bot

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

  9. moved this to Bugs and Follow Up Issues in #expensify-bugson Apr 3, 2025
  10. hoangzinh commented on Apr 4, 2025

    @hoangzinh
    Contributor

    but the backend return the reportName with the formula is {report:type} {report:reportID}. We should fix it from backend side to change the default formula of the title field to {report:type} {report:reportID}

    @nkdengineer I got confused here. Can you clarify what it means? I'm interpreting that because BE is already returning {report:type} {report:reportID}, why do we also need to change the default to {report:type} {report:reportID}?

  11. 17 remaining items

  12. moved this from Bugs and Follow Up Issues to Done in #expensify-bugson Apr 14, 2025
  13. nkdengineer commented on Apr 14, 2025

    @nkdengineer
    Contributor

    @neil-marcellini Can you help advise if it would make sense to move forward with this while you're working on the linked issue?

    @neil-marcellini This is only the back-end part of this issue. We still have the front-end bug with optimistic data here that we need to fix this, please help to re-open this issue.

  14. neil-marcellini commented on Apr 14, 2025

    @neil-marcellini
    Contributor

    The linked issue is specifically for the frontend.

  15. nkdengineer commented on Apr 14, 2025

    @nkdengineer
    Contributor

    The linked issue is specifically for the frontend.

    @neil-marcellini I mean, we're having another bug with Expense preview that isn't related to this issue.

    The current issue is that the Report title of report preview will have the format "Expenses yyyy-mm-dd" briefly (FE optimistic), then change to "Expenses #id" format (BE response).

    The problem we want to confirm here is will this issue fix this backend bug

  16. neil-marcellini commented on Apr 14, 2025

    @neil-marcellini
    Contributor

    Yes we'll make sure the frontend and backend report title computations work the same way.

  17. nkdengineer commented on Apr 15, 2025

    @nkdengineer
    Contributor

    Yes we'll make sure the frontend and backend report title computations work the same way.

    @neil-marcellini Got it now. But our bug here is that the report preview doesn't show the expense report name in offline. And the RCA is not related to the report title computations. It's related to childReportName isn't set of the REPORTPREVIEW action.

  18. hoangzinh commented on Apr 15, 2025

    @hoangzinh
    Contributor

    Agreed with @nkdengineer, the original bug of this issue is report title part is blank because we missed adding optimistic data for report preview. You can take a look at this proposal #59525 (comment) @neil-marcellini

  19. nkdengineer commented on Apr 23, 2025

    @nkdengineer
    Contributor

    @neil-marcellini Please help to check this comment above.

  20. neil-marcellini commented on Apr 25, 2025

    @neil-marcellini
    Contributor

    Agreed with @nkdengineer, the original bug of this issue is report title part is blank because we missed adding optimistic data for report preview. You can take a look at this proposal #59525 (comment) @neil-marcellini

    Right that would be good to fix, but I'm still not clear on whether we can fix this without creating an inconsistency between the optimistic and backend data. If so, please update your proposal to do exactly that and explain why there is no inconsistency. If not, we should keep this closed and fix it holistically.

  21. hoangzinh commented on Apr 27, 2025

    @hoangzinh
    Contributor

    I see. Actually, I'm unsure what the correct way to fix it from FE side. I mean, should we use iouReport.reportName or generate its own report name based on policy.fieldList.text_title.defaultValue. I'm happy to close this issue and fix it holistically here #59525 (comment)

  22. hoangzinh commented on Apr 27, 2025

    @hoangzinh
    Contributor

    @isabelastisser, because the proposal has been accepted and the PR was created. Can you process payment here for @nkdengineer and me? Then we can close this issue.

  23. isabelastisser commented on Apr 28, 2025

    @isabelastisser
    Contributor

    Payment summary:

    $250 for C+ review to @hoangzinh, PENDING in NewDot.
    $250 for proposal to @nkdengineer. Paid in Upwork here.

  24. hoangzinh commented on Apr 28, 2025

    @hoangzinh
    Contributor

    Thank you @isabelastisser. I requested in ND

  25. garrettmknight commented on May 2, 2025

    @garrettmknight
    Contributor

    $250 approved for @hoangzinh

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.ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions