Skip to content

[$250] Expense- Incomplete message context menu & unresponsive whisper after deleting expense offline #68575

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.95-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: #68415
Email or phone of affected tester (no customers): sdjoisjosijsdoj@gmail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.5 / Chrome
App Component: Money Requests

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create an expense to workspace chat.
  4. Open the expense report.
  5. Send a user mention who is not a member of the expense report.
  6. Create another expense in the expense report.
  7. Go offline.
  8. Open the transaction thread of the second expense from Step 6.
  9. Click More > Delete.
  10. Delete the expense.
  11. Right click on the message containing user mention.
    → The context menu is incomplete as options such as React, Edit comment, Reply in thread and Delete comment are missing.
  12. Click Do nothing or Invite them on the whisper message.
    → The options on the whisper message are not responsive.
  13. Go online.
  14. Right click on the message containing user mention.
    → The context menu is now complete with React, Edit comment, Reply in thread and Delete comment option.
  15. Click Do nothing or Invite member on the whisper message.
    → The options on the whisper message are still not responsive.

Expected Result:

In Step 11, the context menu should have the complete options.
In Step 12, the whisper message should dismiss after clicking on Do nothing or Invite them.

Actual Result:

In Step 11, the context menu is missing options such as React, Edit comment, Reply in thread and Delete comment.

In Step 12, the whisper message does not dismiss after clicking on Do nothing or Invite them.

After returning online,
In Step 14, the context menu is now complete with React, Edit comment, Reply in thread and Delete comment option.
In Step 15, the options on the whisper message are still not responsive.

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

Bug6917719_1755238099928.20250815_135858.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021958117484554000745
  • Upwork Job ID: 1958117484554000745
  • Last Price Increase: 2025-09-17
Issue OwnerCurrent Issue Owner: @jasperhuangg

Activity

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

    @melvin-bot

    Triggered auto assignment to @greg-schroeder (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. melvin-bot commented on Aug 15, 2025

    @melvin-bot

    📣 @u-2234! 📣
    Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
    Please follow these steps:

    1. Make sure you've read and understood the contributing guidelines.
    2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
    3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  4. u-2234 commented on Aug 15, 2025

    @u-2234

    Contributor details
    Your Expensify account email: sirajkhatti14@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~018a3960cdaa518f4e

  5. melvin-bot commented on Aug 15, 2025

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  6. mkzie2 commented on Aug 15, 2025

    @mkzie2
    Contributor

    Proposal

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

    In Step 11, the context menu is missing options such as React, Edit comment, Reply in thread and Delete comment.

    What is the root cause of that problem?

    In offline, we can see that one expense report is rendered after we delete the second expense. The reason is that we passed reportTransactionIDs, which contains the list of visible transactionIDs of the expense report

    const transactionThreadReportID = getOneTransactionThreadReportID(report, chatReport, reportActions ?? [], isOffline, reportTransactionIDs);

    So the pending delete iou action can be filtered out here, and this function returns the iou action of the first expense

    if (!isIOUActionMatchingTransactionList(action, reportTransactionIDs, true) || getOriginalMessage(action)?.type === CONST.IOU.REPORT_ACTION_TYPE.PAY) {
    continue;
    }

    But when we get the originalReportID of the action, we don't pass reportTransactionIDs parameter to getOneTransactionThreadReportID function which causes this function returns undefined as the pending delete iou action is not filtered out.

    const originalReportID = useMemo(() => getOriginalReportID(reportID, action), [reportID, action]);

    App/src/libs/ReportUtils.ts

    Lines 9037 to 9057 in 4d29406

    function getOriginalReportID(reportID: string | undefined, reportAction: OnyxInputOrEntry<ReportAction>): string | undefined {
    if (!reportID) {
    return undefined;
    }
    const reportActions = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`];
    const currentReportAction = reportAction?.reportActionID ? reportActions?.[reportAction.reportActionID] : undefined;
    const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`];
    const chatReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${report?.chatReportID}`];
    const transactionThreadReportID = getOneTransactionThreadReportID(report, chatReport, reportActions ?? ([] as ReportAction[]));
    const isThreadReportParentAction = reportAction?.childReportID?.toString() === reportID;
    if (Object.keys(currentReportAction ?? {}).length === 0) {
    return isThreadReportParentAction ? getReport(reportID, allReports)?.parentReportID : (transactionThreadReportID ?? reportID);
    }
    return reportID;
    }
    /**
    * Return the pendingAction and the errors resulting from either
    *
    * - creating a workspace room
    * - starting a chat

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

    Since we render the one expense report view in offline now, there's no reason to keep the pending delete iou action in offline here

    if (
        actionType &&
        iouRequestTypesSet.has(actionType) &&
        action.childReportID &&
        // Include deleted IOU reportActions if:
        // - they have an associated IOU transaction ID or
        // - the action is pending deletion and the user is offline
        !!originalMessage?.IOUTransactionID && 
        action.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE 
    ) {
        iouRequestActions.push(action);
    }
    

    if (!isIOUActionMatchingTransactionList(action, reportTransactionIDs, true) || getOriginalMessage(action)?.type === CONST.IOU.REPORT_ACTION_TYPE.PAY) {
    continue;
    }
    const originalMessage = getOriginalMessage(action);
    const actionType = originalMessage?.type;
    if (
    actionType &&
    iouRequestTypesSet.has(actionType) &&
    action.childReportID &&
    // Include deleted IOU reportActions if:
    // - they have an associated IOU transaction ID or
    // - the action is pending deletion and the user is offline
    (!!originalMessage?.IOUTransactionID || (action.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE && (isOffline ?? isNetworkOffline)))
    ) {
    iouRequestActions.push(action);
    }
    }

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

    NA

    What alternative solutions did you explore? (Optional)

    We can get the reportTransactionIDs from transactions and pass this parameter from getOriginalReportID to getOneTransactionThreadReportAction

    const reportTransactionIDs = transactions?.filter((t) => t?.reportID === reportID && t?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE).map((t) => t?.transactionID).filter(Boolean) as string[];
        // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
        const originalReportID = useMemo(() => getOriginalReportID(reportID, action, reportTransactionIDs), [reportID, action, reportTransactionIDs]);
    

    const originalReportID = useMemo(() => getOriginalReportID(reportID, action), [reportID, action]);

    const transactionThreadReportID = getOneTransactionThreadReportID(report, chatReport, reportActions ?? ([] as ReportAction[]), undefined, reportTransactionIDs);
    

    App/src/libs/ReportUtils.ts

    Lines 9037 to 9057 in 4d29406

    function getOriginalReportID(reportID: string | undefined, reportAction: OnyxInputOrEntry<ReportAction>): string | undefined {
    if (!reportID) {
    return undefined;
    }
    const reportActions = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`];
    const currentReportAction = reportAction?.reportActionID ? reportActions?.[reportAction.reportActionID] : undefined;
    const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`];
    const chatReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${report?.chatReportID}`];
    const transactionThreadReportID = getOneTransactionThreadReportID(report, chatReport, reportActions ?? ([] as ReportAction[]));
    const isThreadReportParentAction = reportAction?.childReportID?.toString() === reportID;
    if (Object.keys(currentReportAction ?? {}).length === 0) {
    return isThreadReportParentAction ? getReport(reportID, allReports)?.parentReportID : (transactionThreadReportID ?? reportID);
    }
    return reportID;
    }
    /**
    * Return the pendingAction and the errors resulting from either
    *
    * - creating a workspace room
    * - starting a chat

    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.

  7. added
    External
    on Aug 20, 2025
  8. melvin-bot commented on Aug 20, 2025

    @melvin-bot
  9. changed the title [-]Expense- Incomplete message context menu & unresponsive whisper after deleting expense offline[/-] [+][$250] Expense- Incomplete message context menu & unresponsive whisper after deleting expense offline[/+] on Aug 20, 2025
  10. added
    Help Wanted
    on Aug 20, 2025
  11. melvin-bot commented on Aug 20, 2025

    @melvin-bot

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

  12. 63 remaining items

  13. jasperhuangg commented on Oct 9, 2025

    @jasperhuangg
    Contributor

    @mkzie2 I think that's fine, it's because the report action exists in the transaction thread and not the expense report, and they it has a different reportID as a result. The link should still take you to the report action, correct?

  14. mkzie2 commented on Oct 10, 2025

    @mkzie2
    Contributor

    @jasperhuangg This will cause the problem when we reply in thread here. Because the originalReportID is wrong, reply in thread will create the report with the wrong data. We should pass originalReportID from BaseReportActionContextMenu to ContextMenuActions instead of calculating it inconsistently here.

    const originalReportID = getOriginalReportID(reportID, reportAction);

  15. mvtglobally commented on Oct 11, 2025

    @mvtglobally

    Issue not reproducible during KI retests. (7th week)

  16. melvin-bot commented on Oct 13, 2025

    @melvin-bot

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

  17. jasperhuangg commented on Oct 14, 2025

    @jasperhuangg
    Contributor

    @mkzie2 Can you clarify what you mean by this:

    reply in thread will create the report with the wrong data.

  18. jasperhuangg commented on Oct 17, 2025

    @jasperhuangg
    Contributor

    @mkzie2 bump

  19. mkzie2 commented on Oct 23, 2025

    @mkzie2
    Contributor

    I can't reproduce this anymore.

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

Metadata

Metadata

Labels

BugDailyExternalHelp Wanted

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions