Skip to content

Split - Splitted expense can be constantly splitted again. #66120

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: 9.1.81-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/6497277&group_by=cases:section_id&group_order=asc&group_id=400779
Email or phone of affected tester (no customers): ibellicotest+1316@gmail.com
Issue reported by: Applause Internal Team
Device used: Motorola MotoG60 - Android 12 - Chrome / Windows 10 - Chrome
App Component: Money Requests

Action Performed:

Prerequisite: Account has at least one workspace.

  1. Open the Expensify app.
  2. Open any workspace chat.
  3. Create a manual expense.
  4. Open the just created expense and tap on "More"
  5. Select "Split" and save the splits amount.
  6. Once redirected to report, open the first split.
  7. Tap on "More"
  8. Note that "Split" option is still available.
  9. Tap on "Split" and save two new splits.
  10. Note that new splits are created and user is redirected to report again.

Expected Result:

User shouldn´t be able to split an expense that was already splitted.

Actual Result:

Already splitted expense, can be constantly splitted again. "Split" option is always available on the first created split.

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

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jul 15, 2025
  2. melvin-bot commented on Jul 15, 2025

    @melvin-bot

    Triggered auto assignment to @trjExpensify (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 Jul 15, 2025

    @melvin-bot

    Triggered auto assignment to @tgolen (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  4. melvin-bot commented on Jul 15, 2025

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  5. github-actions commented on Jul 15, 2025

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  6. nabi-ebrahimi commented on Jul 15, 2025

    @nabi-ebrahimi

    Proposal

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

    Split - Splitted expense can be constantly splitted again.

    What is the root cause of that problem?

    It comes from this PR. We missed adding onyxTransaction.comment to the list of selector checks.

    const getOriginalTransactionWithSplitInfo = (transaction: OnyxEntry<Transaction>) => {
    const {originalTransactionID, source, splits} = transaction?.comment ?? {};
    const originalTransaction = allTransactions?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${originalTransactionID}`];
    if (splits && splits.length > 0) {
    return {isBillSplit: true, isExpenseSplit: false, originalTransaction: originalTransaction ?? transaction};
    }
    if (!originalTransactionID || source !== CONST.IOU.TYPE.SPLIT) {
    return {isBillSplit: false, isExpenseSplit: false, originalTransaction: transaction};
    }
    // To determine if it’s a split bill or a split expense, we check for the presence of `comment.splits` on the original transaction.
    // Since both splits use `comment.originalTransaction`, but split expenses won’t have `comment.splits`.
    return {isBillSplit: !!originalTransaction?.comment?.splits, isExpenseSplit: !originalTransaction?.comment?.splits, originalTransaction: originalTransaction ?? transaction};
    };

    We get the comment from here

    const {originalTransactionID, source, splits} = transaction?.comment ?? {}; 

    As we didn't add the comment to the selector checklist, we don't get the updated transaction with updated comment. so the following condition is true.

         if (!originalTransactionID || source !== CONST.IOU.TYPE.SPLIT) { 
             return {isBillSplit: false, isExpenseSplit: false, originalTransaction: transaction}; 
         } 

    And the split option is added to the list of options here

    if (isSplitAction(parentReport, [reportTransaction], policy)) {
    options.push(CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.SPLIT);
    }

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

    We need to update

    selector: (onyxTransaction) =>
    onyxTransaction && {
    transactionID: onyxTransaction.transactionID,
    reportID: onyxTransaction.reportID,
    amount: onyxTransaction.amount,
    currency: onyxTransaction.currency,
    merchant: onyxTransaction.merchant,
    created: onyxTransaction.created,
    category: onyxTransaction.category,
    tag: onyxTransaction.tag,
    billable: onyxTransaction.billable,
    reimbursable: onyxTransaction.reimbursable,
    receipt: onyxTransaction.receipt,
    filename: onyxTransaction.filename,
    pendingAction: onyxTransaction.pendingAction,
    errors: onyxTransaction.errors,
    hasEReceipt: onyxTransaction.hasEReceipt,
    cardID: onyxTransaction.cardID,
    },

    add comment: onyxTransaction.comment to the list.

      selector: (onyxTransaction) =>
                    onyxTransaction && {
                        transactionID: onyxTransaction.transactionID,
                        reportID: onyxTransaction.reportID,
                        amount: onyxTransaction.amount,
                        currency: onyxTransaction.currency,
                        merchant: onyxTransaction.merchant,
                        created: onyxTransaction.created,
                        category: onyxTransaction.category,
                        tag: onyxTransaction.tag,
                        billable: onyxTransaction.billable,
                        reimbursable: onyxTransaction.reimbursable,
                        receipt: onyxTransaction.receipt,
                        filename: onyxTransaction.filename,
                        pendingAction: onyxTransaction.pendingAction,
                        errors: onyxTransaction.errors,
                        hasEReceipt: onyxTransaction.hasEReceipt,
                        cardID: onyxTransaction.cardID,
                        comment: onyxTransaction.comment
                    },

    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)

  7. rushatgabhane commented on Jul 15, 2025

    @rushatgabhane
    Member

    @BlameGPT please find the cause

  8. BlameGPT commented on Jul 15, 2025

    @BlameGPT
    Contributor

    Who let the bugs out? 🐛

    If not above, check these

  9. tgolen commented on Jul 15, 2025

    @tgolen
    Contributor

    @rinej Do you agree with this comment that pointed to your PR as the root cause? If someone can confirm that reverting that PR fixes the problem, let's go ahead and revert it.

  10. tgolen commented on Jul 15, 2025

    @tgolen
    Contributor

    @jponikarchuk I am not able to reproduce this locally. I split the expense once, but there is not an option to split either new transaction an additional time.

    Image

    On Staging, I don't even have the option to split:

    Image
  11. trjExpensify commented on Jul 16, 2025

    @trjExpensify
    Contributor
    Image

    @lakchote @garrettmknight is this something to do with "Phase 2" rollout of Split? I thought we were still going to show Edit split or something in the more menu to get back to the split screen to recalculate the splits? 🤔

  12. lakchote commented on Jul 16, 2025

    @lakchote
    Contributor

    @lakchote @garrettmknight is this something to do with "Phase 2" rollout of Split? I thought we were still going to show Edit split or something in the more menu to get back to the split screen to recalculate the splits? 🤔

    Phase 2 of Splits is not live yet. We will present the user with the splits edit table on existing splits when Phase 2 is live.

    Also, like @tgolen said in their comment here, I'm unable to reproduce the issue on my environment with the latest changes.

  13. trjExpensify commented on Jul 16, 2025

    @trjExpensify
    Contributor

    Phase 2 of Splits is not live yet. We will present the user with the splits edit table on existing splits when Phase 2 is live.

    Okay, in which case, why isn't the split button appearing on expenses that have been split?

  14. garrettmknight commented on Jul 16, 2025

    @garrettmknight
    Contributor

    iirc it was a technical decision we made to keep the data for splits in phase 1 clean, so when we got to phase 2, we could reference the original transaction ID to show the split children in the split table view. If we'd have allowed splitting again, then we'd end up with Split > Create Trans 2 & 3 with Transaction 1 as the originalTransaction > Split > Create Trans 4 & 5 with Trans 2 as the originalTransaction.

    Editing split transactions in Phase 2 should be online shortly and solve for this.

  15. garrettmknight commented on Jul 16, 2025

    @garrettmknight
    Contributor

    But taking it back to the bug in the OP, this shouldn't be allowed at this point and it's a regression because it wasn't previously.

  16. trjExpensify commented on Jul 16, 2025

    @trjExpensify
    Contributor

    Okay, I'm with Tim and Lucien that I can't repro the bug in the OP.

  17. tgolen commented on Jul 16, 2025

    @tgolen
    Contributor

    Fun times! I'm just going to close this for now then.

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

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions