Skip to content

Fix/73390 - Split Transation - Reply link is shown after deleting an expense - #84551

Merged
luacmartins merged 20 commits into
Expensify:mainfrom
dmkt9:fix/73390-split-transaction
Mar 30, 2026
Merged

luacmartins merged 20 commits into
Expensify:mainfrom
dmkt9:fix/73390-split-transaction

Conversation

@dmkt9

@dmkt9 dmkt9 commented Mar 9, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

The follow-up PR for #74186.
Here, we will continue handling the split transaction scenario.

Fixed Issues

$ #73390
PROPOSAL: #73390 (comment)

Tests

Same as QA Steps

  • Verify that no errors appear in the JS console

Offline tests

Test 1: Comments should be copied to split transactions

  1. Go to staging.new.expensify.com.
  2. Create two expenses in a workspace chat.
  3. Click on the newly created report.
  4. Click on one of the expenses.
  5. Add some comments to it.
  6. Go offline.
  7. Click on More > Split > Save.
  8. Note that the user is navigated back to the report, and each split expense has a comment count equal to that of the original expense.
  9. Go to the workspace chat.
  10. Note that the "Reply" hyperlink count below the expense preview is displayed correctly.

Test 2: Expense preview should update when a split transaction is deleted

  1. Go to staging.new.expensify.com.
  2. Create two expenses in a workspace chat.
  3. Click on the newly created report.
  4. Click on one of the expenses.
  5. Add a comment to it.
  6. Go offline.
  7. Click on More > Split into 3 transactions > Save.
  8. Note that the user is navigated back to the report, and each split expense has a comment count equal to the original expense.
  9. Delete one of the three split transactions.
  10. Go to the workspace chat.
  11. Note that the "Reply" hyperlink count below the expense preview is displayed correctly.

Test 3: Original transaction should capture all comments from the remaining split transaction when reverting

  1. Go to staging.new.expensify.com.
  2. Create two expenses in a workspace chat.
  3. Click on the newly created report.
  4. Click on one of the expenses.
  5. Go offline.
  6. Click on More > Split into 2 transactions > Save.
  7. Add a comment to one of the split transactions.
  8. Delete the other split transaction.
  9. Note that the original transaction is restored with the comments from the remaining split transaction.
  10. Go to the workspace chat.
  11. Note that the "Reply" hyperlink count below the expense preview is displayed correctly.

QA Steps

Test 1: Comments should be copied to split transactions

  1. Go to staging.new.expensify.com.
  2. Create two expenses in a workspace chat.
  3. Click on the newly created report.
  4. Click on one of the expenses.
  5. Add some comments to it.
  6. Click on More > Split > Save.
  7. Note that the user is navigated back to the report, and each split expense has a comment count equal to that of the original expense.
  8. Go to the workspace chat.
  9. Note that the "Reply" hyperlink count below the expense preview is displayed correctly.

Test 2: Expense preview should update when a split transaction is deleted

  1. Go to staging.new.expensify.com.
  2. Create two expenses in a workspace chat.
  3. Click on the newly created report.
  4. Click on one of the expenses.
  5. Add a comment to it.
  6. Click on More > Split into 3 transactions > Save.
  7. Note that the user is navigated back to the report, and each split expense has a comment count equal to the original expense.
  8. Delete one of the three split transactions.
  9. Go to the workspace chat.
  10. Note that the "Reply" hyperlink count below the expense preview is displayed correctly.

Test 3: Original transaction should capture all comments from the remaining split transaction when reverting

  1. Go to staging.new.expensify.com.
  2. Create two expenses in a workspace chat.
  3. Click on the newly created report.
  4. Click on one of the expenses
  5. Click on More > Split into 2 transactions > Save.
  6. Add a comment to one of the split transactions.
  7. Delete the other split transaction.
  8. Note that the original transaction is restored with the comments from the remaining split transaction.
  9. Go to the workspace chat.
  10. Note that the "Reply" hyperlink count below the expense preview is displayed correctly.
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified there are no new alerts related to the canBeMissing param for useOnyx
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Test 1: Comments should be copied to split transactions

Android: Native
android.antive.mp4
Android: mWeb Chrome
android.mweb.mp4
iOS: Native
ios.native.mp4
iOS: mWeb Safari
ios.mweb.mp4
MacOS: Chrome / Safari
mac.safari.1.mp4

Test 2: Expense preview should update when a split transaction is deleted

mac.safari.2.mp4

Test 3: Original transaction should capture all comments from the remaining split transaction when reverting

mac.safari.3.mp4

@codecov

codecov Bot commented Mar 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/libs/ReportUtils.ts 79.31% <100.00%> (+0.07%) ⬆️
src/libs/actions/IOU/index.ts 73.36% <100.00%> (+0.38%) ⬆️
src/libs/actions/IOU/Split.ts 80.98% <94.52%> (+2.15%) ⬆️
... and 6 files with indirect coverage changes

@dmkt9
dmkt9 marked this pull request as ready for review March 10, 2026 15:41
@dmkt9
dmkt9 requested review from a team as code owners March 10, 2026 15:41
@melvin-bot
melvin-bot Bot requested review from dukenv0307 and removed request for a team March 10, 2026 15:41
@melvin-bot

melvin-bot Bot commented Mar 10, 2026

Copy link
Copy Markdown

@dukenv0307 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot requested review from trjExpensify and removed request for a team March 10, 2026 15:41
@dmkt9

dmkt9 commented Mar 10, 2026 •

Copy link
Copy Markdown
Contributor Author

@dukenv0307 @luacmartins Hi, this PR is ready for review. However, it requires some backend support regarding the following:

Notes for BE Support Request:

  1. Comment Synchronization for Split Transactions:
    Currently, copying comments from the original transaction to split transactions is functional on both BE and FE. However, BE does not yet support FE in sending reportActions for these comments to maintain synchronization. This lack of alignment is currently causing duplicate comments.

  2. RevertSplitTransaction API Issues:

  • We have added transactionThreadReportID to the API parameters on the FE, but it appears to be ignored by the BE. Consequently, the BE still returns a new transactionThreadReportID upon a successful RevertSplitTransaction.
  • Additionally, the BE is returning incorrect transaction data after reverting, resulting in duplicated transaction violation.

@luacmartins

Copy link
Copy Markdown
Contributor

@MelvinBot make a plan to implement the backend changes requested above

@MelvinBot

Copy link
Copy Markdown
Contributor

🔍 Backend Implementation Plan for Split Transaction Support

Based on the BE support request from dmkt9, here is a plan addressing both issues. This plan is based on thorough analysis of the FE code in App/src/libs/actions/IOU/Split.ts and the API parameter types in App/src/libs/API/parameters/SplitTransactionParams.ts.


Issue 1: Comment Synchronization for Split Transactions (Duplicate Comments)

Problem: When a transaction is split, the FE optimistically copies all ADDCOMMENT report actions from the original transaction's thread to each new split transaction's thread (see addCommentToSplitTransactionThread() at Split.ts:1412-1429). However, the BE also creates these comments independently. Since neither side knows about the other's work, comments are duplicated.

Root Cause: The FE generates optimistic report action IDs for the copied comments (NumberUtils.rand64()) but does NOT include these IDs in the API parameters sent to the BE. The BE has no way to reconcile its server-created comments with the FE's optimistic ones.

Recommended Fix — Option A (Preferred): BE returns comment reportActions, FE reconciles via successData

  1. In the Transaction_Split command handler (BE): When creating split transactions, if the original transaction's thread has comments, copy them to each new split's transaction thread. Return the created reportActions in the API response (via Onyx push updates).

  2. The BE response should include reportActions keyed by the transactionThreadReportID that the FE sends in splits[i][transactionThreadReportID]. This allows the FE's optimistic data to be properly overwritten by the server-authoritative data.

  3. Important: The BE should use the transactionThreadReportID provided by the FE (not generate a new one) so the Onyx keys align. The FE already sends this ID in the split params at Split.ts:1402-1406.

Recommended Fix — Option B (Simpler): FE handles all comment copying, BE skips it

  1. In the Transaction_Split command handler (BE): Do NOT copy comments to split transaction threads. Leave comment copying entirely to the FE's optimistic logic.

  2. The BE should ensure that the transactionThreadReportID values provided by the FE are used when creating the transaction thread reports, so the FE's optimistic report actions land in the correct Onyx keys.

  3. Tradeoff: This approach is simpler but means if the API call fails, the FE failure rollback removes the copied comments (which is already handled at Split.ts:1429). However, if there's a crash or network issue where neither success nor failure fires, comments could be lost.

Recommendation: Option A is more robust. The BE should own comment copying and return the authoritative reportActions. The FE's optimistic data serves only as a placeholder until the BE response arrives. The key requirement is that the BE uses the FE-provided transactionThreadReportID so Onyx keys match.


Issue 2: RevertSplitTransaction API Issues

There are two sub-issues here:

2a: transactionThreadReportID is ignored by the BE

Problem: The FE sends transactionThreadReportID as part of the RevertSplitTransaction params (populated at Split.ts:1403 and sent at Split.ts:1765-1771). This is the optimistic ID for the reverted transaction's thread report. The BE ignores this and creates/returns a new transactionThreadReportID, causing a mismatch between the FE's optimistic Onyx data and the BE's response.

FE parameter type (SplitTransactionParams.ts:31):

type RevertSplitTransactionParams = Omit<SplitTransactionSplitParam, 'comment'> & {comment?: string};
// Includes: transactionThreadReportID, createdReportActionIDForThread, splitReportActionID

Recommended Fix:

  1. In the RevertSplitTransaction command handler (BE): Read the transactionThreadReportID parameter from the request.
  2. Use this ID when creating or referencing the transaction thread report for the reverted transaction, instead of generating a new one.
  3. Similarly, use createdReportActionIDForThread (also sent by the FE) as the report action ID for the "created" action in the transaction thread.
  4. The splitReportActionID should be used as the IOU report action ID for the reverted transaction.

This pattern is consistent with how other Expensify API commands handle optimistic IDs — the FE generates IDs, the BE uses them, ensuring Onyx data stays in sync.

2b: BE returns incorrect transaction data after reverting (duplicated transactions)

Problem: After RevertSplitTransaction succeeds, the BE returns transaction data that causes duplicated transactions on the FE.

Expected BE behavior based on FE optimistic data (Split.ts:1609-1707):

  1. The original transaction should NOT have its reportID set to SPLIT_REPORT_ID ('-2'). During revert, the FE only clears the original transaction's errors (line 1700-1706).
  2. The child split transactions that are being removed should be deleted.
  3. The remaining split's data should be merged into the reverted transaction (using the params sent: amount, category, tag, merchant, comment, etc.).
  4. The original transaction's IOU report action should be preserved (NOT deleted — unlike during split creation).

Recommended Fix:

  1. In the RevertSplitTransaction handler: Delete all child split transactions.
  2. Update the original transaction with the field values from the request params (amount, category, tag, merchant, comment, etc.) — these represent the remaining split's data that should become the reverted transaction's data.
  3. Do NOT create a new transaction — reuse the original transactionID that was passed in the params.
  4. Create/update the transaction thread report using the transactionThreadReportID from the params (issue 2a above).
  5. Return Onyx updates that:
    • Set the reverted transaction with the correct reportID (the original expense report, not '-2')
    • Remove the child split transactions
    • Include the transaction thread report and its report actions (including copied comments from the remaining split's thread)

Summary of BE Changes Required

Component Change Priority
Transaction_Split handler Either return reportActions for copied comments (Option A) or skip comment copying and let FE handle it (Option B) High — causes duplicate comments
RevertSplitTransaction handler Use transactionThreadReportID from FE params instead of generating a new one High — causes Onyx mismatch
RevertSplitTransaction handler Use createdReportActionIDForThread and splitReportActionID from FE params High — related to above
RevertSplitTransaction handler Fix transaction data returned — don't duplicate transactions, reuse original transactionID High — causes duplicated transactions
RevertSplitTransaction handler Copy comments from remaining split's thread to reverted transaction's thread (if using Option A for issue 1) Medium — consistency

Files to Modify (Backend)

Since the Auth/ and Web-Expensify/ repositories are not available in this workspace, the exact file paths cannot be confirmed. The likely locations are:

  • Transaction_Split handler: Look for SplitTransaction or Transaction_Split in the API command handlers (likely in Web-Expensify/lib/ or Auth/auth/command/)
  • RevertSplitTransaction handler: Look for RevertSplitTransaction in the same locations
  • Shared transaction utilities: Any helpers that create transaction thread reports or copy report actions between threads

FE Code References (for understanding expected behavior)

  • App/src/libs/actions/IOU/Split.ts:1033-1793 — Main updateSplitTransactions() function
  • App/src/libs/actions/IOU/Split.ts:1076-1077 — isReverseSplitOperation detection
  • App/src/libs/actions/IOU/Split.ts:1412-1429 — addCommentToSplitTransactionThread() optimistic comment copying
  • App/src/libs/actions/IOU/Split.ts:1502-1510 — Comment copying during revert
  • App/src/libs/actions/IOU/Split.ts:1765-1771 — RevertSplitTransaction API call
  • App/src/libs/API/parameters/SplitTransactionParams.ts:1-33 — Parameter type definitions

Next Steps: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this plan.

@dmkt9

dmkt9 commented Mar 11, 2026

Copy link
Copy Markdown
Contributor Author
  • Additionally, the BE is returning incorrect transaction data after reverting, resulting in duplicated transactions

Oh, sorry. By "duplicated transactions" I actually meant "a duplicated transaction violation". It seems I left out a word. I’ve corrected it in the original comment.

@luacmartins

Copy link
Copy Markdown
Contributor

@MelvinBot update the proposal based on this comment #84551 (comment)

@MelvinBot

Copy link
Copy Markdown
Contributor

Updated Backend Implementation Plan for Split Transaction Support

Updated based on the clarification from dmkt9: "duplicated transactions" was corrected to "duplicated transaction violation" — meaning the BE is returning a constraint/uniqueness violation error, not creating extra transaction records.

This updates Issue 2b from my previous plan. Issues 1, 2a remain unchanged.


Issue 2b (Corrected): BE returns a duplicated transaction violation after reverting

Problem: After RevertSplitTransaction succeeds, the BE triggers a duplicated transaction violation — a constraint/uniqueness error. This suggests the BE is attempting to create a new transaction (or re-insert an existing one) using a transactionID that already exists in the database, rather than updating/reusing the original transaction in place.

Likely Root Cause: The RevertSplitTransaction handler probably tries to create a new transaction for the reverted expense instead of updating the existing original transaction. Since the original transactionID is passed in the params and still exists in the DB (it was moved to SPLIT_REPORT_ID / '-2' during the split, not deleted), the BE hits a uniqueness constraint when trying to insert a transaction with that same ID.

Expected BE behavior based on FE optimistic data (Split.ts:1609-1707):

  1. The original transaction already exists — it should be updated in place, not re-created. During a split, the original transaction's reportID is set to SPLIT_REPORT_ID ('-2') to hide it. During revert, it should be restored to the original expense report's reportID.
  2. The child split transactions should be deleted.
  3. The remaining split's data (amount, category, tag, merchant, comment, etc. from the request params) should be merged into the original transaction.
  4. The original transaction's IOU report action should be preserved (NOT deleted).

Recommended Fix:

  1. In the RevertSplitTransaction handler: Instead of creating a new transaction, UPDATE the existing transaction identified by the transactionID param.
  2. Restore the original transaction's reportID from SPLIT_REPORT_ID ('-2') back to the correct expense report ID.
  3. Apply the field values from the request params (amount, category, tag, merchant, comment, created, etc.) to the existing transaction — these represent the remaining split's data.
  4. Delete all child split transactions that were created during the original split operation.
  5. Create/update the transaction thread report using the transactionThreadReportID from the params (Issue 2a).
  6. Return Onyx updates that:
    • Set the reverted transaction with the correct reportID and updated fields
    • Remove the child split transactions (set to null)
    • Include the transaction thread report and its report actions

Key insight: The FE never deletes the original transaction during a split — it only hides it by setting reportID to '-2'. The revert should reverse this by restoring the reportID and updating the transaction fields. No new transaction creation should occur.


Full Summary of BE Changes Required (Updated)

Component Change Priority
Transaction_Split handler Either return reportActions for copied comments (Option A) or skip comment copying and let FE handle it (Option B) High — causes duplicate comments
RevertSplitTransaction handler Use transactionThreadReportID from FE params instead of generating a new one High — causes Onyx mismatch
RevertSplitTransaction handler Use createdReportActionIDForThread and splitReportActionID from FE params High — related to above
RevertSplitTransaction handler UPDATE existing transaction instead of creating a new one — restore reportID from '-2' back to expense report, apply field values from params, delete child split transactions High — causes duplicated transaction violation
RevertSplitTransaction handler Copy comments from remaining split's thread to reverted transaction's thread (if using Option A for Issue 1) Medium — consistency

All other sections from the previous plan (Issue 1, Issue 2a, FE code references) remain unchanged.


Next Steps: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this plan.

trjExpensify
trjExpensify previously approved these changes Mar 11, 2026

@trjExpensify trjExpensify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up bug fix. 👍

@luacmartins
luacmartins self-requested a review March 11, 2026 23:29
@luacmartins

luacmartins commented Mar 16, 2026 •

Copy link
Copy Markdown
Contributor

@dmkt9

Comment Synchronization for Split Transactions:
Currently, copying comments from the original transaction to split transactions is functional on both BE and FE. However, BE does not yet support FE in sending reportActions for these comments to maintain synchronization. This lack of alignment is currently causing duplicate comments.

For the SplitTransactions API, we need to add the following to each split object:

"copiedComments": {[originalReportActionID]: optimisticReportActionID}

So that the BE can use these optimistic IDs when creating new threads/copied comments. The BE PR is in review for that

@luacmartins

Copy link
Copy Markdown
Contributor

We have added transactionThreadReportID to the API parameters on the FE, but it appears to be ignored by the BE. Consequently, the BE still returns a new transactionThreadReportID upon a successful RevertSplitTransaction.

@dmkt9 it seems like we merged a PR to add this to the BE last week. It was deployed a bit before your comment. Can you check if this is still the case please?

@luacmartins

Copy link
Copy Markdown
Contributor

Additionally, the BE is returning incorrect transaction data after reverting, resulting in duplicated transaction violation.

@dmkt9 what incorrect data is it returning?

@luacmartins

Copy link
Copy Markdown
Contributor

@dmkt9 PR is in staging. You can test with the staging API

@dmkt9

dmkt9 commented Mar 27, 2026

Copy link
Copy Markdown
Contributor Author

@luacmartins, thank you. It works well.

@luacmartins

Copy link
Copy Markdown
Contributor

Cool. I think we can move forward with this PR and not block on the violation issue. @dukenv0307 can you please review again?

@luacmartins
luacmartins requested a review from dukenv0307 March 27, 2026 15:54
@dukenv0307

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 56f1aeb251

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/libs/actions/IOU/Split.ts Resolved
Comment thread src/libs/actions/IOU/Split.ts Resolved
@dukenv0307

dukenv0307 commented Mar 29, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified there are no new alerts related to the canBeMissing param for useOnyx
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Screen.Recording.2026-03-30.at.09.23.16.mov
Android: mWeb Chrome
Screen.Recording.2026-03-30.at.09.10.47.mov
iOS: HybridApp
Screen.Recording.2026-03-30.at.09.18.09.mov
iOS: mWeb Safari
Screen.Recording.2026-03-30.at.09.09.27.mov
MacOS: Chrome / Safari
Screen.Recording.2026-03-29.at.10.30.19.mov
Screen.Recording.2026-03-29.at.10.32.25.mov
Screen.Recording.2026-03-29.at.10.39.38.mov

@dukenv0307

Copy link
Copy Markdown
Contributor

Bug:

  1. Go through all steps of test case 3
  2. Go online, wait until the APIs call successfully
  3. Go offline
  4. Observe that the comments turn gray as pending actions
Screen.Recording.2026-03-29.at.10.50.23.mov

@dmkt9

dmkt9 commented Mar 29, 2026

Copy link
Copy Markdown
Contributor Author

@dukenv0307 This PR is ready for review again. Thank you.

@dukenv0307 dukenv0307 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


let updatedReportPreviewAction: Partial<OnyxTypes.ReportAction> | undefined;
const originalReportPreviewAction = getReportPreviewAction(expenseReport?.chatReportID, expenseReport?.reportID);
const transactionReportActions = getAllReportActions(firstIOU?.childReportID);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're deprecating this method in another PR, but for the future, please make these functions pure by subscribing to the data with useOnyx at the call site and pass it down as a param.

const allCommentActionsFromOriginalTransactionThread = Object.values(transactionReportActions ?? {})
.filter((action) => isAddCommentAction(action) && !isDeletedAction(action) && action?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE)
.sort((a, b) => (a.created > b.created ? 1 : -1));
const expenseReportNameValuePairs = allReportNameValuePairsList?.[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${expenseReport?.reportID}`];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with this an any function that uses variables from Onyx.connect

@luacmartins
luacmartins merged commit 4b0d1f2 into Expensify:main Mar 30, 2026
33 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🚧 @luacmartins has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/luacmartins in version: 9.3.51-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

@MelvinBot

Copy link
Copy Markdown
Contributor

I have failed to help you. I let you down and for that I am sorry. Please try again later. This may be due to a Claude outage (check here).

Failure details: https://github.com/Expensify/Expensify/actions/runs/23816891211

@nlemma

nlemma commented Mar 31, 2026

Copy link
Copy Markdown

Deploy Blocker #86798 was identified to be related to this PR.

@OSBotify

OSBotify commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.3.51-10 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 failure ❌
🍎 iOS 🍎 success ✅

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants