Skip to content

[Due for payment 2025-05-27] [$250] expense-Concierge message is shown after deleting the expense #60999

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: V9.1.33-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
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: N/A
Email or phone of affected tester (no customers): Sloottwo1 4@gmail.com
Issue reported by: Applause Internal Team
Device used: Redminote 10s android 13
App Component: Money Requests

Action Performed:

  1. Launch app
  2. Open a workspace chat
  3. Create 2 manual expenses without selecting category
  4. Open the expense report
  5. Open the second expense
  6. Tap header - delete the expense

Expected Result:

Concierge message musnt be shown after deleting the expense.

Actual Result:

Concierge message is shown after deleting 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

Bug6815715_1745877043964.Screenrecorder-2025-04-29-03-15-13-640.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021917004187845693619
  • Upwork Job ID: 1917004187845693619
  • Last Price Increase: 2025-05-05
  • Automatic offers:
    • ikevin127 | Reviewer | 107245531
Issue OwnerCurrent Issue Owner: @lydiabarclay

Activity

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

    @melvin-bot

    Triggered auto assignment to @lydiabarclay (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. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Apr 28, 2025
  4. melvin-bot commented on Apr 28, 2025

    @melvin-bot
  5. changed the title [-]expense-Concierge message is shown after deleting the expense[/-] [+][$250] expense-Concierge message is shown after deleting the expense[/+] on Apr 28, 2025
  6. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Apr 28, 2025
  7. melvin-bot commented on Apr 28, 2025

    @melvin-bot

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

  8. thelullabyy commented on Apr 29, 2025

    @thelullabyy
    Contributor

    Proposal

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

    • After deleting an expense, the Concierge message is incorrectly shown.

    What is the root cause of that problem?

    • When a transaction is deleted, the category options in the UI are not disabled as expected. Specifically, in this section of the code, we do not disable the options when the associated transaction has been removed.

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

    • Introduce a new check to determine whether the transaction associated with getOriginalMessage(action)?.transactionID has been deleted.
    • If the transaction no longer exists, we should disable the whisper buttons accordingly.
    • Proposed code adjustment:
    isDisabled: isResolved || !getTransaction(getOriginalMessage(action)?.transactionID)

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

    • N/A

    What alternative solutions did you explore? (Optional)

    Option 1: Hide the category options whisper.

    • In here, we can early return false if the transaction is removed:
        if (isConciergeCategoryOptions(reportAction) && !getTransaction(getOriginalMessage(action).transactionID)) {
            return false;
        }

    Option 2: Delete the category options whisper message.

    • In here, update to:
        const transactionThreadReportActions = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadID}`] ?? {};
        const hasCategoryOptionsWhisper = Object.values(transactionThreadReportActions).find((action) => isConciergeCategoryOptions(action));
        const shouldDeleteTransactionThread = transactionThreadID ? (reportAction?.childVisibleActionCount ?? 0) === (hasCategoryOptionsWhisper ? 1 : 0) : false;
    • In here, add the optimistic data to delete category options whisper message:
    const transactionThreadReportActions = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadID}`] ?? {};
        const categoryOptionsWhisper = Object.values(transactionThreadReportActions).find((action) => isConciergeCategoryOptions(action));
        if (categoryOptionsWhisper) {
            const deletedMessage: Message[] = [
                {
                    translationKey: '',
                    type: 'COMMENT',
                    html: '',
                    text: '',
                    isEdited: true,
                    isDeletedParentAction: false,
                },
            ];
            const optimisticReportActions: NullishDeep<OnyxTypes.ReportActions> = {
                [categoryOptionsWhisper.reportActionID]: {
                    pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE,
                    previousMessage: reportAction.message,
                    message: deletedMessage,
                    errors: null,
                    linkMetadata: [],
                },
            };
            optimisticData.push({
                onyxMethod: Onyx.METHOD.MERGE,
                key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadID}`,
                value: optimisticReportActions,
            });
        }
    • The details can be completed in PR phase, when we can compare with the BE's response to correct our optimistic data.
  9. Nick4dawin commented on Apr 29, 2025

    @Nick4dawin

    Proposal

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

    After deleting an expense, the Concierge message is incorrectly shown with active category option buttons. This creates a confusing user experience where users can see and interact with category options for a transaction that no longer exists.

    What is the root cause of that problem?

    When a transaction is deleted, the category options in the UI are not properly disabled. The code doesn't check whether the associated transaction still exists before displaying the actionable buttons. Currently, the only check is whether the category options are resolved, but there's no verification that the underlying transaction still exists:

    if (isConciergeCategoryOptions(action)) {
        const options = getOriginalMessage(action)?.options;
        if (!options) {
            return [];
        }
        const isResolved = isResolvedConciergeCategoryOptions(action);
        return options.map((option, i) => ({
            text: `${i + 1} - ${option}`,
            key: `${action.reportActionID}-conciergeCategoryOptions-${option}`,
            onPress: () => {
                addComment(originalReportID, option);
            },
            isDisabled: isResolved,
        }));
    }

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

    1. Add a check in PureReportActionItem.tsx to determine if the transaction associated with the concierge category options still exists using TransactionUtils.getTransaction().
    2. Update the isDisabled property of the concierge category option buttons to return true when the transaction has been deleted.
    3. Add a condition to not render the ActionableItemButtons component at all when all items are disabled.
    4. Update the OriginalMessageConciergeCategoryOptions type to include the transactionID property.

    Here are the key code changes:

    // In PureReportActionItem.tsx
    if (isConciergeCategoryOptions(action)) {
        const options = getOriginalMessage(action)?.options;
        if (!options) {
            return [];
        }
        const isResolved = isResolvedConciergeCategoryOptions(action);
        const transactionID = getOriginalMessage(action)?.transactionID;
        const transactionExists = TransactionUtils.getTransaction(transactionID);
        
        return options.map((option, i) => ({
            text: `${i + 1} - ${option}`,
            key: `${action.reportActionID}-conciergeCategoryOptions-${option}`,
            onPress: () => {
                addComment(originalReportID, option);
            },
            isDisabled: isResolved || !transactionExists,
        }));
    }
    // Condition to prevent rendering buttons when all are disabled
    {actionableItemButtons.length > 0 && actionableItemButtons.some(item => !item.isDisabled) && (
        <ActionableItemButtons
            items={actionableItemButtons}
            layout={isActionableTrackExpense(action) || isConciergeCategoryOptions(action) ? 'vertical' : 'horizontal'}
            shouldUseLocalization={!isConciergeCategoryOptions(action)}
        />
    )}
    // Update to OriginalMessageConciergeCategoryOptions type definition
    /** Model of `concierge category options` report action */
    type OriginalMessageConciergeCategoryOptions = {
        /** The options we present to the user when confidence in the predicted category is low */
        options: string[];
        
        /** ID of the transaction */
        transactionID?: string;
    };

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

    N/A

    What alternative solutions did you explore? (Optional)

    Option 1: Hide the entire concierge category options message when the transaction is deleted by modifying the message rendering logic to check for transaction existence before displaying the message.

    function shouldShowConciergeCategoryOptions(reportAction) {
        if (isConciergeCategoryOptions(reportAction)) {
            const transactionID = getOriginalMessage(reportAction)?.transactionID;
            return !!TransactionUtils.getTransaction(transactionID);
        }
        return false;
    }

    Option 2: Delete the category options whisper message when a transaction is deleted, by adding logic to the transaction deletion process. This would involve modifying the optimistic data in the delete transaction flow to also remove the associated concierge message:

    // In the transaction deletion logic
    const transactionThreadReportActions = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadID}`] ?? {};
    const categoryOptionsWhisper = Object.values(transactionThreadReportActions).find((action) => isConciergeCategoryOptions(action));
    if (categoryOptionsWhisper) {
        optimisticData.push({
            onyxMethod: Onyx.METHOD.SET,
            key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadID}`,
            value: {
                [categoryOptionsWhisper.reportActionID]: null,
            },
        });
    }
  10. ikevin127 commented on Apr 29, 2025

    @ikevin127
    Contributor

    Thanks everybody for the proposals! Unfortunately none of the current proposals are fixing the issue according to the Expected result, which states:

    Concierge message musnt be shown after deleting the expense.

    ❌ The main solutions of both proposals are only disabling the 3 buttons that the Concierge message shows -> this means that the Concierge message / thread reply are still visible.

    ❌ Proposal 1 - Alternative 1 doesn't work as long as the report is opened, only works if we havigate back to expense group, then it will show Deleted expense, but still display the Concierge thread reply under the Deleted expense.

    ❌ Proposal 1 - Alternative 2 this seems to work as expected, will transition back to expenses group and show Deleted expense after the expense is deleted, but will still display the Concierge thread reply (which we don't want).

    Image

    ♻ For a complete solution for this issue, according to the Expected result we're looking at something similar to what Proposal 1 - Alternative 2 proposed, but with the addition that the Concierge thread reply must be removed as well.

    cc @thelullabyy @Nick4dawin to update proposals according to expected result (if still interested)

  11. thelullabyy commented on May 2, 2025

    @thelullabyy
    Contributor

    Thanks everybody for the proposals! Unfortunately none of the current proposals are fixing the issue according to the Expected result, which states:
    Concierge message musnt be shown after deleting the expense.

    @ikevin127 If we're aligning with this expected behavior, we'll need support from the backend as well. Could you check with the internal engineering team to confirm whether the backend can accommodate this? Once the backend implementation is ready, I’ll update the solution to match the new response structure from BE side?

  12. 42 remaining items

  13. trjExpensify commented on May 12, 2025

    @trjExpensify
    Contributor

    @JakubKorytko is doing the PR over on #61775
    @DylanDylann is reviewing the PR ^^
    No separate PR is being drafted or reviewed on this GH
    So will be payment be handled over on #61775

    Yep, correct. This issue is going to be solved by another issue now. Typically what I do in this situation is one of two things:

    1. If it's confirmed it will for sure be solved by the other one or a straight up dupe, I just close the issue.
    2. If it's a bit TBD (i.e "I think this will be fixed here"), then I pop a [Hold #61775] in the title and drop it to weekly. Once the PR for the other issue in question is deployed > re-test to confirm > close or progress it.

    In this case, I'm confident with option 1 because Jakub shared a vid here illustrating the fix from this WIP PR, so we can just close this out.

    I don't see a BZ assigned on the other one.

    👋 it's-a-me!

  14. melvin-bot commented on May 16, 2025

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  15. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on May 20, 2025
  16. changed the title [-][$250] expense-Concierge message is shown after deleting the expense[/-] [+][Due for payment 2025-05-27] [$250] expense-Concierge message is shown after deleting the expense[/+] on May 20, 2025
  17. melvin-bot commented on May 20, 2025

    @melvin-bot

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

  18. melvin-bot commented on May 20, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.46-12 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-05-27. 🎊

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

  19. melvin-bot commented on May 20, 2025

    @melvin-bot

    @DylanDylann @lydiabarclay @DylanDylann 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]

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