Skip to content

Commit 6e467dc

Browse files
authored
Merge pull request Expensify#67469 from huult/66138-empty-report-after-split-and-delete
fix empty report displayed after splitting track expense and deleting…
2 parents 2ca9068 + b3cf03d commit 6e467dc

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

src/libs/actions/IOU.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12145,12 +12145,37 @@ function saveSplitTransactions(draftTransaction: OnyxEntry<OnyxTypes.Transaction
1214512145

1214612146
API.write(WRITE_COMMANDS.SPLIT_TRANSACTION, parameters, {optimisticData, successData, failureData});
1214712147
InteractionManager.runAfterInteractions(() => removeDraftSplitTransaction(originalTransactionID));
12148+
1214812149
const isSearchPageTopmostFullScreenRoute = isSearchTopmostFullScreenRoute();
12150+
const transactionThreadReportID = iouActions.at(0)?.childReportID;
12151+
const transactionThreadReportScreen = Navigation.getReportRouteByID(transactionThreadReportID);
12152+
1214912153
if (isSearchPageTopmostFullScreenRoute || !transactionReport?.parentReportID) {
1215012154
Navigation.dismissModal();
12155+
12156+
// After the modal is dismissed, remove the transaction thread report screen
12157+
// to avoid navigating back to a report removed by the split transaction.
12158+
requestAnimationFrame(() => {
12159+
if (!transactionThreadReportScreen?.key) {
12160+
return;
12161+
}
12162+
12163+
Navigation.removeScreenByKey(transactionThreadReportScreen.key);
12164+
});
12165+
1215112166
return;
1215212167
}
1215312168
Navigation.dismissModalWithReport({reportID: expenseReport?.reportID ?? String(CONST.DEFAULT_NUMBER_ID)});
12169+
12170+
// After the modal is dismissed, remove the transaction thread report screen
12171+
// to avoid navigating back to a report removed by the split transaction.
12172+
requestAnimationFrame(() => {
12173+
if (!transactionThreadReportScreen?.key) {
12174+
return;
12175+
}
12176+
12177+
Navigation.removeScreenByKey(transactionThreadReportScreen.key);
12178+
});
1215412179
}
1215512180

1215612181
export {

0 commit comments

Comments
 (0)