Repository navigation
Fix/73390 - Split Transation - Reply link is shown after deleting an expense - #84551
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@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] |
|
@dukenv0307 @luacmartins Hi, this PR is ready for review. However, it requires some backend support regarding the following: Notes for BE Support Request:
|
|
@MelvinBot make a plan to implement the backend changes requested above |
🔍 Backend Implementation Plan for Split Transaction SupportBased on the BE support request from Issue 1: Comment Synchronization for Split Transactions (Duplicate Comments)Problem: When a transaction is split, the FE optimistically copies all Root Cause: The FE generates optimistic report action IDs for the copied comments ( Recommended Fix — Option A (Preferred): BE returns comment reportActions, FE reconciles via successData
Recommended Fix — Option B (Simpler): FE handles all comment copying, BE skips it
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 Issue 2:
|
| 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_Splithandler: Look forSplitTransactionorTransaction_Splitin the API command handlers (likely inWeb-Expensify/lib/orAuth/auth/command/)RevertSplitTransactionhandler: Look forRevertSplitTransactionin 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— MainupdateSplitTransactions()functionApp/src/libs/actions/IOU/Split.ts:1076-1077—isReverseSplitOperationdetectionApp/src/libs/actions/IOU/Split.ts:1412-1429—addCommentToSplitTransactionThread()optimistic comment copyingApp/src/libs/actions/IOU/Split.ts:1502-1510— Comment copying during revertApp/src/libs/actions/IOU/Split.ts:1765-1771—RevertSplitTransactionAPI callApp/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.
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. |
|
@MelvinBot update the proposal based on this comment #84551 (comment) |
Updated Backend Implementation Plan for Split Transaction SupportUpdated based on the clarification from This updates Issue 2b from my previous plan. Issues 1, 2a remain unchanged. Issue 2b (Corrected): BE returns a duplicated transaction violation after revertingProblem: After Likely Root Cause: The Expected BE behavior based on FE optimistic data (
Recommended Fix:
Key insight: The FE never deletes the original transaction during a split — it only hides it by setting Full Summary of BE Changes Required (Updated)
All other sections from the previous plan (Issue 1, Issue 2a, FE code references) remain unchanged. Next Steps: Reply with |
trjExpensify
left a comment
There was a problem hiding this comment.
Follow-up bug fix. 👍
For the SplitTransactions API, we need to add the following to each split object: So that the BE can use these optimistic IDs when creating new threads/copied comments. The BE PR is in review for that |
@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? |
@dmkt9 what incorrect data is it returning? |
|
@dmkt9 PR is in staging. You can test with the staging API |
|
@luacmartins, thank you. It works well. |
|
Cool. I think we can move forward with this PR and not block on the violation issue. @dukenv0307 can you please review again? |
|
@codex review |
There was a problem hiding this comment.
💡 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".
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-03-30.at.09.23.16.movAndroid: mWeb ChromeScreen.Recording.2026-03-30.at.09.10.47.moviOS: HybridAppScreen.Recording.2026-03-30.at.09.18.09.moviOS: mWeb SafariScreen.Recording.2026-03-30.at.09.09.27.movMacOS: Chrome / SafariScreen.Recording.2026-03-29.at.10.30.19.movScreen.Recording.2026-03-29.at.10.32.25.movScreen.Recording.2026-03-29.at.10.39.38.mov |
|
Bug:
Screen.Recording.2026-03-29.at.10.50.23.mov |
|
@dukenv0307 This PR is ready for review again. Thank you. |
|
|
||
| let updatedReportPreviewAction: Partial<OnyxTypes.ReportAction> | undefined; | ||
| const originalReportPreviewAction = getReportPreviewAction(expenseReport?.chatReportID, expenseReport?.reportID); | ||
| const transactionReportActions = getAllReportActions(firstIOU?.childReportID); |
There was a problem hiding this comment.
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}`]; |
There was a problem hiding this comment.
Same with this an any function that uses variables from Onyx.connect
|
🚧 @luacmartins has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 9.3.51-0 🚀
Bundle Size Analysis (Sentry): |
|
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 |
|
Deploy Blocker #86798 was identified to be related to this PR. |
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.3.51-10 🚀
|
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
Offline tests
Test 1: Comments should be copied to split transactions
staging.new.expensify.com.Test 2: Expense preview should update when a split transaction is deleted
staging.new.expensify.com.Test 3: Original transaction should capture all comments from the remaining split transaction when reverting
staging.new.expensify.com.QA Steps
Test 1: Comments should be copied to split transactions
staging.new.expensify.com.Test 2: Expense preview should update when a split transaction is deleted
staging.new.expensify.com.Test 3: Original transaction should capture all comments from the remaining split transaction when reverting
staging.new.expensify.com.PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.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