Skip to content

[Due for payment 2025-09-19] [$250] mWeb/Chrome - LHN - No GBR shown in ws chat after deleting report #69031

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.97-2
Reproducible in staging?: Y
Reproducible in production?: Y
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): Sintayewkindu7@gmail.com
Issue reported by: Applause - Internal Team

Action Performed:

  1. Navigating to staging.new.expensify.com
  2. Create Workspace
  3. Submit expense
  4. Note there is GBR in LHN
  5. Create a report in the workspace
  6. Note there is GBR still
  7. Delete the report created in step 5
  8. Navigate to LHN

Expected Result:

GBR still exist as the expense exist in WS chat

Actual Result:

GBR is not shown after deleting Report until navigating to the WS chat

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
Bug6923022_1755790540071.Recording_20250821_172755.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021959775776292267733
  • Upwork Job ID: 1959775776292267733
  • Last Price Increase: 2025-08-25
Issue OwnerCurrent Issue Owner: @jliexpensify

Activity

  1. added
    Daily
    Bug
    on Aug 22, 2025
  2. melvin-bot commented on Aug 22, 2025

    @melvin-bot

    Triggered auto assignment to @jliexpensify (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 Aug 22, 2025

    @FitseTLT
    Contributor

    Proposal

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

    mWeb/Chrome - LHN - No GBR shown in ws chat after deleting report

    What is the root cause of that problem?

    We are resetting hasOutstandingChildRequest of the chatReport when deleting the report

    App/src/libs/actions/Report.ts

    Lines 5063 to 5067 in d7214c5

    optimisticData.push({
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`,
    value: {hasOutstandingChildRequest: false},
    });

    without checking if action is required from the user after that iou report is deleted

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

    We need to only reset it if there is no hasOutstandingChildRequest after the deletion of the iou report so we can recalculate it via hasIOUToApproveOrPay like we do here

    hasOutstandingChildRequest: hasIOUToApproveOrPay(chatReport, updatedExpenseReport),

    But hasIOUToApproveOrPay only includes the case of approve and pay action but BE considers a request as outstanding for the case of submit action too so we will update it to hasIOUToSubmitApproveOrPay to consider the submit case too (but if needed we can apply the submit case only for our case via a param but I suggest it applies to other cases we using it currently)
    we will pass the deletedReportPreviewActionID

    App/src/libs/actions/IOU.ts

    Lines 9586 to 9600 in d7214c5

    function getIOUReportActionToApproveOrPay(chatReport: OnyxEntry<OnyxTypes.Report>, updatedIouReport: OnyxEntry<OnyxTypes.Report>): OnyxEntry<ReportAction> {
    const chatReportActions = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${chatReport?.reportID}`] ?? {};
    return Object.values(chatReportActions).find((action) => {
    if (!action) {
    return false;
    }
    const iouReport = updatedIouReport?.reportID === action.childReportID ? updatedIouReport : getReportOrDraftReport(action.childReportID);
    // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850
    // eslint-disable-next-line deprecation/deprecation
    const policy = getPolicy(iouReport?.policyID);
    const shouldShowSettlementButton = canIOUBePaid(iouReport, chatReport, policy) || canApproveIOU(iouReport, policy);
    return action.actionName === CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW && shouldShowSettlementButton && !isDeletedAction(action);
    });
    }

     function getIOUReportActionToSubmitApproveOrPay(
        chatReport: OnyxEntry<OnyxTypes.Report>,
        updatedIouReport: OnyxEntry<OnyxTypes.Report>,
        deletedReportPreviewActionID?: string,
    ): OnyxEntry<ReportAction> {
        const chatReportActions = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${chatReport?.reportID}`] ?? {};
    
        return Object.values(chatReportActions).find((action) => {
            if (!action || action.reportActionID === deletedReportPreviewActionID) {
                return false;
            }
            const iouReport = updatedIouReport?.reportID === action.childReportID ? updatedIouReport : getReportOrDraftReport(action.childReportID);
            // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850
            // eslint-disable-next-line deprecation/deprecation
            const policy = getPolicy(iouReport?.policyID);
            const reportTransactions = getReportTransactions(iouReport?.reportID);
    
            const shouldShowSettlementButton =
                canIOUBePaid(iouReport, chatReport, policy) || canApproveIOU(iouReport, policy) || canSubmitReport(iouReport, policy, reportTransactions, undefined, false);
            return action.actionName === CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW && shouldShowSettlementButton && !isDeletedAction(action);
        });
    }
    
    

    BTW alternatively we can utilize the already existing param updatedIouReport instead by passing the deleted iouReport with pending deletion set and use it instead of deletedReportPreviewActionID in the above.

    value: {hasOutstandingChildRequest: false},

            value: {hasOutstandingChildRequest: !!getIOUReportActionToSubmitApproveOrPay(getReportOrDraftReport(report?.parentReportID), undefined, reportActionID)},
    
    

    Note: We are using hasIOUToApproveOrPay here for approve action and hasOutstandingChildRequest here for pay action to recalculate hasOutstandingChildRequest of the chatReport and there is no basic difference in the functions because hasIOUToApproveOrPay takes the updatedIOUReport and hasOutstandingChildRequest takes the iouReport that was paid to recalcaulate the new value based on the changes linked to the respective actions. So I recommend to join this two functions together and use them to recalculate in all cases needed. We can easily handle it via a param updatedIOUReportOrDelettedIOUReportID which can have Report or string type and if string is passed we know that we should not consider the passed iou report id in the calculation. I also see other cases where we are wrongly resetting hasOutstandingChildRequest instead of recalculating it, for instance, for the case of delete the only money request of an iou report here

    App/src/libs/actions/IOU.ts

    Lines 8244 to 8246 in d7214c5

    key: `${ONYXKEYS.COLLECTION.REPORT}${chatReport?.reportID}`,
    value: {
    hasOutstandingChildRequest: false,

    Therefore, we should use a centrialized DRY single function in all cases needed to recalculate hasOutstandingChildRequest instead of resetting in all cases needed 👍

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

    We can add a test for deleteAppReport that it doesn't reset hasOutstandingChildRequest of the chatReport while there is action required from the user.

    What alternative solutions did you explore? (Optional)

  4. nkdengineer commented on Aug 22, 2025

    @nkdengineer
    Contributor

    Proposal

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

    GBR is not shown after deleting Report until navigating to the WS chat

    What is the root cause of that problem?

    We are setting hasOutstandingChildRequest as false here

    App/src/libs/actions/Report.ts

    Lines 5063 to 5073 in 91f5892

    optimisticData.push({
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`,
    value: {hasOutstandingChildRequest: false},
    });
    failureData.push({
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`,
    value: {hasOutstandingChildRequest: report?.hasOutstandingChildRequest},
    });

    It leads to us not having requiresAttention here

    const {hasAnyViolations, requiresAttention, reportErrors} = generateReportAttributes({
    report,
    chatReport,
    reportActions,
    transactionViolations,
    isReportArchived,
    });

    => We don't have the field brickRoadStatus in reportAttributes Onyx data

    // if report does not have error, check if it should show green dot
    if (brickRoadStatus !== CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR && requiresAttention) {
    brickRoadStatus = CONST.BRICK_ROAD_INDICATOR_STATUS.INFO;
    }

    => we don't have brickRoadIndicator in getOptionData function

    result.brickRoadIndicator = reportAttributes?.brickRoadStatus;

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

    We should reset the hasOutstandingChildRequest base on the same existing logic that we have in IOU.ts here

    App/src/libs/actions/IOU.ts

    Lines 9091 to 9108 in 91f5892

    function hasOutstandingChildRequest(chatReport: OnyxTypes.Report, excludedIOUReport: OnyxEntry<OnyxTypes.Report>, policyId?: string) {
    // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850
    // eslint-disable-next-line deprecation/deprecation
    const policy = getPolicy(policyId);
    if (!policy?.achAccount?.bankAccountID) {
    return false;
    }
    const reportActions = getAllReportActions(chatReport.reportID);
    return !!Object.values(reportActions).find((action) => {
    const iouReportID = getIOUReportIDFromReportActionPreview(action);
    if (iouReportID === excludedIOUReport?.reportID) {
    return false;
    }
    const iouReport = getReportOrDraftReport(iouReportID);
    const transactions = getReportTransactions(iouReportID);
    return canIOUBePaid(iouReport, chatReport, policy, transactions) || canIOUBePaid(iouReport, chatReport, policy, transactions, true);
    });
    }

    1. We should create a new util function like getHasOutstandingChildRequest
    function getHasOutstandingChildRequest(chatReport: OnyxEntry<Report>, excludedIOUReport: OnyxEntry<Report>, policyId?: string) {
        const policy = getPolicy(policyId);
        const reportActions = getAllReportActions(chatReport.reportID);
        return !!Object.values(reportActions).find((action) => {
            const iouReportID = getIOUReportIDFromReportActionPreview(action);
            if (iouReportID === excludedIOUReport?.reportID) {
                return false;
            }
            const iouReport = getReportOrDraftReport(iouReportID);
            const transactions = getReportTransactions(iouReportID);
            return canIOUBePaid(iouReport, chatReport, policy, transactions)
                    || canIOUBePaid(iouReport, chatReport, policy, transactions, true)
                    || canApproveIOU(iouReport, policy, transactions)
                    || canSubmitReport(iouReport, policy, transactions, undefined, false); // we can pass the allViolations here
        });
    }
    
    1. Then reset the hasOutstandingChildRequest in optimisticData
        const hasOutstandingChildRequest = getHasOutstandingChildRequest(getReportOrDraftReport(parentReportID), report, report?.policyID);
    
        optimisticData.push({
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`,
            value: {hasOutstandingChildRequest},
        });
    

    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)

    We can add test for the deleteAppReport to cover this scenario

    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. dubielzyk-expensify commented on Aug 25, 2025

    @dubielzyk-expensify
    Contributor

    Yeah seems like a bug given there should be a GBR for the submit action, right? @trjExpensify for confirmation

  6. jliexpensify commented on Aug 25, 2025

    @jliexpensify
    Contributor

    Thanks for confirming Jon - that makes sense re: the submit action.

  7. added
    External
    on Aug 25, 2025
  8. changed the title [-]mWeb/Chrome - LHN - No GBR shown in ws chat after deleting report[/-] [+][$250] mWeb/Chrome - LHN - No GBR shown in ws chat after deleting report[/+] on Aug 25, 2025
  9. melvin-bot commented on Aug 25, 2025

    @melvin-bot
  10. added
    Help Wanted
    on Aug 25, 2025
  11. 25 remaining items

  12. changed the title [-][$250] mWeb/Chrome - LHN - No GBR shown in ws chat after deleting report[/-] [+][Due for payment 2025-09-19] [$250] mWeb/Chrome - LHN - No GBR shown in ws chat after deleting report[/+] on Sep 12, 2025
  13. removed
    Reviewing
    on Sep 12, 2025
  14. melvin-bot commented on Sep 12, 2025

    @melvin-bot

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

  15. melvin-bot commented on Sep 12, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.12-4 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-09-19. 🎊

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

    • @FitseTLT requires payment (Needs manual offer from BZ)
    • @thesahindia requires payment through NewDot Manual Requests
  16. melvin-bot commented on Sep 12, 2025

    @melvin-bot

    @thesahindia @jliexpensify 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]

  17. added
    Daily
    and removed
    Weekly
    on Sep 18, 2025
  18. jliexpensify commented on Sep 19, 2025

    @jliexpensify
    Contributor

    @thesahindia bumping you for the checklist please

  19. jliexpensify commented on Sep 19, 2025

    @jliexpensify
    Contributor

    Payment Summary

    • C: @FitseTLT $250 (to be paid via Upworks)
    • C+: @thesahindia (to be paid via New Expensify requests) - checklist please!

    https://www.upwork.com/jobs/~021959775776292267733

  20. jliexpensify commented on Sep 19, 2025

    @jliexpensify
    Contributor

    Paid and job closed

  21. melvin-bot commented on Sep 19, 2025

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@jliexpensify)

    • (if NewFeature) I have created a PR for any necessary HelpDot updates, or I confirmed no updates are necessary.
    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1959775776292267733/hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  22. thesahindia commented on Sep 20, 2025

    @thesahindia
    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: Not from one specific PR

    • [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: N/A

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

    Regression Test Proposal Template
    • [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. Go to any workspace chat
    2. Submit an expense
    3. Verify GBR appears for the report in LHN
    4. Create a report in the workspace
    5. Verify the GBR is present
    6. Delete the newly created report
    7. Verify GBR is still present for the report in LHN

    Do we agree 👍 or 👎

  23. garrettmknight commented on May 21, 2026

    @garrettmknight
    Contributor

    $250 approved for @thesahindia

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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions