Skip to content

[Due for payment 2026-04-14][$250] Hold Expense - Reply link is shown after deleting an expense #73390

Closed

Description

@jponikarchuk

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.2.37-6
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #73379
Email or phone of affected tester (no customers): agexptest+pr2310@gmail.com
Issue reported by: Applause Internal Team
Device used: Windows 11/ Chrome, Samsung S23FE/ Android 15, iPhone 13 Mini/ iOS 18.5
App Component: Money Requests

Action Performed:

  1. Go to staging.new.expensify.com
  2. Create 2 expenses in a 1:1 conversation DM
  3. Click on the report created
  4. Click on an expense
  5. Put it on hold with a comment
  6. Click on the header of the same expense > Delete the expense
  7. Go to the 1:1 conversation DM

Expected Result:

The "Reply" hyperlink below the expense preview is not shown.

Actual Result:

The "Reply" hyperlink below the expense preview is shown.

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

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021983277787564040184
  • Upwork Job ID: 1983277787564040184
  • Last Price Increase: 2025-10-28
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

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

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (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. hasib711 commented on Oct 24, 2025

    @hasib711

    Proposal

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

    The "Reply" hyperlink below the expense preview is not shown.

    What is the root cause of that problem?

    On the report page, the display of replies is determined by the childCommenterCount and childVisibleActionCount of the selected report action.

    App/blob/main/src/pages/home/report/PureReportActionItem.tsx

    Line 1534
    
    {shouldDisplayThreadReplies && (
                        <View style={draftMessageRightAlign}>
                            <ReportActionItemThread
                                reportAction={action}
                                reportID={reportID}
                                numberOfReplies={numberOfThreadReplies}
                                mostRecentReply={`${action.childLastVisibleActionCreated}`}
                                isHovered={hovered || isContextMenuActive}
                                accountIDs={oldestFourAccountIDs}
                                onSecondaryInteraction={showPopover}
                                isActive={isReportActionActive && !isContextMenuActive}
                            />
                        </View>
                    )}
    

    App/blob/main/src/pages/home/report/PureReportActionItem.tsx

    Line 1485
    
    const shouldDisplayThreadReplies = shouldDisplayThreadRepliesUtils(action, isThreadReportParentAction) && !isOnSearch;
    

    App/blob/main/src/libs/ReportUtils.ts

    Line 10076
    /**
     * Checks if thread replies should be displayed
     */
    function shouldDisplayThreadReplies(reportAction: OnyxInputOrEntry<ReportAction>, isThreadReportParentAction: boolean): boolean {
        const hasReplies = (reportAction?.childVisibleActionCount ?? 0) > 0;
        return hasReplies && !!reportAction?.childCommenterCount && !isThreadReportParentAction;
    }
    

    However, when an expense is deleted, the process didn't update the childCommenterCount and childVisibleActionCount of the action.

    App/blob/main/src/libs/actions/IOU.ts

    Line 8616
    function deleteMoneyRequest(
        transactionID: string | undefined,
        reportAction: OnyxTypes.ReportAction,
        transactions: OnyxCollection<OnyxTypes.Transaction>,
        violations: OnyxCollection<OnyxTypes.TransactionViolations>,
        iouReport: OnyxEntry<OnyxTypes.Report>,
        chatReport: OnyxEntry<OnyxTypes.Report>,
        isChatIOUReportArchived: boolean | undefined,
        isSingleTransactionView = false,
        transactionIDsPendingDeletion?: string[],
        selectedTransactionIDs?: string[],
    ) {
    if (!transactionID) {
            return;
        }
    
        // STEP 1: Calculate and prepare the data
        const {
            shouldDeleteTransactionThread,
            shouldDeleteIOUReport,
            updatedReportAction,
            updatedIOUReport,
            updatedReportPreviewAction,
            transactionThreadID,
            transactionThread,
            transaction,
            transactionViolations,
            reportPreviewAction,
        } = prepareToCleanUpMoneyRequest(transactionID, reportAction, iouReport, chatReport, isChatIOUReportArchived, false, transactionIDsPendingDeletion, selectedTransactionIDs);
    

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

    We need to update the childCommenterCount and childVisibleActionCount of the action.
    App/src/libs/actions/Report.ts

    Line 8203
    function prepareToCleanUpMoneyRequest(
        transactionID: string,
        reportAction: OnyxTypes.ReportAction,
        iouReport: OnyxEntry<OnyxTypes.Report>,
        chatReport: OnyxEntry<OnyxTypes.Report>,
        isChatReportArchived: boolean | undefined,
        shouldRemoveIOUTransactionID = true,
        transactionIDsPendingDeletion?: string[],
        selectedTransactionIDs?: string[],
    ) {
    

    What alternative solutions did you explore? (Optional)

  4. dmkt9 commented on Oct 24, 2025

    @dmkt9
    Contributor

    Proposal

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

    The "Reply" hyperlink below the expense preview is shown.

    What is the root cause of that problem?

    1. After deleting an expense, childVisibleActionCount and childCommenterCount are not decremented, so thread replies are still shown.

      const numberOfThreadReplies = action.childVisibleActionCount ?? 0;
      const shouldDisplayThreadReplies = shouldDisplayThreadRepliesUtils(action, isThreadReportParentAction) && !isOnSearch;

      {shouldDisplayThreadReplies && (
      <View style={draftMessageRightAlign}>
      <ReportActionItemThread

    2. deleteMoneyRequest uses prepareToCleanUpMoneyRequest to generate the updatedReportPreviewAction.

      App/src/libs/actions/IOU.ts

      Lines 8633 to 8645 in 302280e

      const {
      shouldDeleteTransactionThread,
      shouldDeleteIOUReport,
      updatedReportAction,
      updatedIOUReport,
      updatedReportPreviewAction,
      transactionThreadID,
      transactionThread,
      transaction,
      transactionViolations,
      reportPreviewAction,
      } = prepareToCleanUpMoneyRequest(transactionID, reportAction, iouReport, chatReport, isChatIOUReportArchived, false, transactionIDsPendingDeletion, selectedTransactionIDs);

    3. However, prepareToCleanUpMoneyRequest only updates childMoneyRequestCount and message for updatedReportPreviewAction.

      App/src/libs/actions/IOU.ts

      Lines 8350 to 8366 in 302280e

      if (getReportActionMessage(updatedReportPreviewAction)) {
      if (Array.isArray(updatedReportPreviewAction?.message)) {
      const message = updatedReportPreviewAction.message.at(0);
      if (message) {
      message.text = messageText;
      message.html = messageText;
      message.deleted = shouldDeleteIOUReport ? DateUtils.getDBTime() : '';
      }
      } else if (!Array.isArray(updatedReportPreviewAction.message) && updatedReportPreviewAction.message) {
      updatedReportPreviewAction.message.text = messageText;
      updatedReportPreviewAction.message.deleted = shouldDeleteIOUReport ? DateUtils.getDBTime() : '';
      }
      }
      if (updatedReportPreviewAction && reportPreviewAction?.childMoneyRequestCount && reportPreviewAction?.childMoneyRequestCount > 0) {
      updatedReportPreviewAction.childMoneyRequestCount = reportPreviewAction.childMoneyRequestCount - 1;
      }

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

    In prepareToCleanUpMoneyRequest, we need to update childVisibleActionCount and childCommenterCount using a helper similar to getOptimisticDataForParentReportAction.

    App/src/libs/ReportUtils.ts

    Lines 10214 to 10247 in 302280e

    function getOptimisticDataForParentReportAction(report: Report | undefined, lastVisibleActionCreated: string, type: string): Array<OnyxUpdate | null> {
    if (!report || isEmptyObject(report)) {
    return [];
    }
    const ancestors = getAllAncestorReportActionIDs(report, true);
    const totalAncestor = ancestors.reportIDs.length;
    let previousActionDeleted = false;
    return Array.from(Array(totalAncestor), (_, index) => {
    const ancestorReport = getReportOrDraftReport(ancestors.reportIDs.at(index));
    if (!ancestorReport || isEmptyObject(ancestorReport)) {
    return null;
    }
    const ancestorReportAction = getReportAction(ancestorReport.reportID, ancestors.reportActionsIDs.at(index) ?? '');
    if (!ancestorReportAction?.reportActionID || isEmptyObject(ancestorReportAction)) {
    return null;
    }
    const updatedReportAction = updateOptimisticParentReportAction(ancestorReportAction, lastVisibleActionCreated, type, previousActionDeleted ? index + 1 : undefined);
    previousActionDeleted = isDeletedAction(ancestorReportAction) && updatedReportAction.childVisibleActionCount === 0;
    return {
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${ancestorReport.reportID}`,
    value: {
    [ancestorReportAction.reportActionID]: updatedReportAction,
    },
    };
    });
    }

    We can’t use it directly because getOptimisticDataForParentReportAction is currently designed to handle adding a single action or deleting a single comment — meaning it only accounts for one removable action. In our case, the number of visible actions being deleted could be greater than one.

    This will ensure correct behavior in offline mode. Additionally, we need to update the backend to return childVisibleActionCount and childCommenterCount for the correct action.

    What alternative solutions did you explore? (Optional)

    N/A

  5. melvin-bot commented on Oct 27, 2025

    @melvin-bot

    @mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 28, 2025
  7. melvin-bot commented on Oct 28, 2025

    @melvin-bot
  8. changed the title [-]Hold Expense - Reply link is shown after deleting an expense[/-] [+][$250] Hold Expense - Reply link is shown after deleting an expense[/+] on Oct 28, 2025
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 28, 2025
  10. melvin-bot commented on Oct 28, 2025

    @melvin-bot

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

  11. 87 remaining items

  12. luacmartins commented on Apr 10, 2026

    @luacmartins
    Contributor

    @dukenv0307 #84551 was a follow up for a known issue of #74186, right?

  13. dukenv0307 commented on Apr 13, 2026

    @dukenv0307
    Contributor

    @luacmartins that's right

  14. luacmartins commented on Apr 13, 2026

    @luacmartins
    Contributor

    Ok, in that case I think $500 for both PRs is ok, since we merged the first one with the known issue.

  15. melvin-bot commented on Apr 14, 2026

    @melvin-bot

    Payment Summary

    Upwork Job

    • Reviewer: @dukenv0307 owed $250 via NewDot
    • ROLE: @dmkt9 paid $(AMOUNT) via Upwork (LINK)

    BugZero Checklist (@mallenexpensify)

    • (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/1983277787564040184/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
  16. mallenexpensify commented on Apr 16, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @dmkt9 oaud $500 via Upwork
    Contributor+: @dukenv0307 due $500 via NewDot

    @dmkt9 can you please accept the job below? Please reply here and tag me once you have.
    https://www.upwork.com/jobs/~022044855461933875738

    @dukenv0307 plz complete the BZ checklist and tag me in a post once you have. Thx

  17. dukenv0307 commented on Apr 17, 2026

    @dukenv0307
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to the comment on the PR: https://github.com/Expensify/App/pull/79648/changes#r3098755854

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

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

      Link to issue: https://github.com/Expensify/Expensify/issues/625436

    Regression Test Proposal

    Precondition:

    Test:

    1. Go to staging.new.expensify.com
    2. Create 2 expenses in a 1:1 conversation DM
    3. Click on the report created
    4. Click on an expense
    5. Put it on hold with a comment
    6. Go offline
    7. Click on the header of the same expense > Delete the expense
    8. Go to the 1:1 conversation DM
    9. Note that the "Reply" hyperlink below the expense preview is not shown.

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-8205-a28d-473c-b8a5883102e4
  18. dukenv0307 commented on Apr 17, 2026

    @dukenv0307
    Contributor
  19. dmkt9 commented on Apr 17, 2026

    @dmkt9
    Contributor

    @dmkt9 can you please accept the job below? Please reply here and tag me once you have.

    @mallenexpensify Thanks. I've accepted the offer, and I noticed that the amount is $250

  20. mallenexpensify commented on Apr 17, 2026

    @mallenexpensify
    Contributor

    @dmkt9 paid, summary updated above. Thx. Thx for the reminder that it's $500.

    ^ Test case created

  21. quinthar commented on Apr 21, 2026

    @quinthar
    Contributor

    Approved $500 to @dukenv0307

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 contributorOverdue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions