Migrate split thread comments to the original transaction's optimistic thread when reverting a split#86469
Open
rayane-d wants to merge 16 commits intoExpensify:mainfrom
Open
Migrate split thread comments to the original transaction's optimistic thread when reverting a split#86469rayane-d wants to merge 16 commits intoExpensify:mainfrom
rayane-d wants to merge 16 commits intoExpensify:mainfrom
Conversation
When reverting a split, user comments in the chosen split's transaction thread are migrated to the restored original transaction's thread by the backend. This adds matching frontend optimistic data so the UI reflects the migration immediately, and passes the optimistic thread IDs to the backend so both sides use the same report IDs.
…read comments When reverting a split, user comments are moved from the split's transaction thread to the restored original transaction's thread. The parent IOU action on the expense report needs its childVisibleActionCount, childCommenterCount, childLastVisibleActionCreated, and childOldestFourAccountIDs updated to reflect the migrated comments, otherwise the thread reply indicator shows 0 replies. On failure, these fields are reset since the comments remain in the split thread.
Updated the type of successMovedComments from a Record to OnyxCollection for better type safety and clarity in handling migrated comments during split transactions.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Updated the logic for retrieving the revertSplitIOUAction to use getIOUActionForTransactionID. Additionally, refactored the filtering of splitThreadUserComments to utilize isActionOfType.
Verifies that when reverting a split transaction (isReverseSplitOperation), user comments from the chosen split's transaction thread are migrated to the restored original transaction's new thread. The test creates a workspace expense, splits it into two, injects a comment on one split's thread, then reverts the split and asserts the comment appears in the new transaction thread with correct data.
Verify that after reverting a split, the migrated comment is no longer accessible from the old split transaction thread (which is deleted during the revert operation).
Verify the original transaction is restored with correct amount and currency, the chosen split is force-deleted, and the other split is marked with pendingAction: delete.
Verify the new IOU action has correct actionName, IOUTransactionID, amount, currency, and type.
Verify the new IOU action has correct childVisibleActionCount, childCommenterCount, childOldestFourAccountIDs, and childLastVisibleActionCreated reflecting the migrated comments.
8 tasks
Contributor
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppCleanShot.2026-03-30.at.23.53.25.5.mp4Android: mWeb ChromeCleanShot.2026-03-30.at.23.56.36.6.mp4iOS: HybridAppCleanShot.2026-03-30.at.23.48.44.3.mp4iOS: mWeb SafariCleanShot.2026-03-30.at.23.42.46.2.mp4MacOS: Chrome / SafariCurrent PR CleanShot.2026-03-31.at.00.16.05.1.mp4Latest staging CleanShot.2026-03-31.at.00.07.15.1.mp4 |
Contributor
|
@rayane-d There is a conflict, and we have an issue on iOS/mWeb. The error page briefly appears (1:11) then goes into an infinite loop when using “go back.” but This issue cannot be reproduced on the latest staging. Current PRCleanShot.2026-03-31.at.00.18.59.1.mp4Latest stagingCleanShot.2026-03-31.at.00.11.10.2.mp4 |
Contributor
|
I’ve merged the latest main into the current PR, and this issue can be resolved. CleanShot.2026-03-31.at.00.44.36.1.mp4 |
Contributor
|
@rayane-d Could you simplify the test steps? Here is the current behavior is observed from steps 14–19, we haven't any transaction with amount 100$
And it the same for steps 22–26, only remaining transaction with amount 60$
And for steps 27–31, I think we don’t need them. |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Explanation of Change
When reverting a split transaction, user comments added to split transaction threads were permanently lost because all splits and their threads were deleted without preserving comments.
This PR adds optimistic data to
updateSplitTransactionsso that whenisReverseSplitOperationis triggered, comments from the chosen split's transaction thread are migrated to the restored original transaction's new optimistic thread before the split is deleted. It also sendstransactionThreadReportIDandcreatedReportActionIDForThreadto the backend so that the optimistic thread ID matches the ID of the thread cerated in BE.Changes in
Split.ts:ADDCOMMENTactions on the chosen split's thread before revertingchildVisibleActionCount,childCommenterCount,childLastVisibleActionCreated, andchildOldestFourAccountIDson the new IOU action of the restored transactionFixed Issues
$ #76011
PROPOSAL:
Tests
Offline tests
The offline behavior is tested in the tests section
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand 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
Screen.Recording.2026-03-27.at.1.21.44.AM.mov
Simulator.Screen.Recording.-.iPhone.16.Pro.Max.mov
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari