From 778ddbddd374a2daf75f456a61beb0812c011559 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Tue, 3 Oct 2023 16:22:06 +0700 Subject: [PATCH] fix LHN is disappeared when leaving thread --- src/libs/actions/Report.js | 9 --------- src/pages/home/ReportScreen.js | 12 ++++++++++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index e21d9fdd75c6..8663345b9994 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -1922,15 +1922,6 @@ function leaveRoom(reportID) { ], }, ); - Navigation.dismissModal(); - if (Navigation.getTopmostReportId() === reportID) { - Navigation.goBack(ROUTES.HOME); - } - if (report.parentReportID) { - Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.parentReportID), CONST.NAVIGATION.TYPE.FORCED_UP); - return; - } - navigateToConciergeChat(); } /** diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index 7a979ae18783..873d8c4d5079 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -314,7 +314,15 @@ function ReportScreen({ // optimistic case (prevOnyxReportID && prevOnyxReportID === routeReportID && !onyxReportID && prevReport.statusNum === CONST.REPORT.STATUS.OPEN && report.statusNum === CONST.REPORT.STATUS.CLOSED) ) { - Navigation.goBack(); + Navigation.dismissModal(); + if (Navigation.getTopmostReportId() === prevOnyxReportID) { + Navigation.setShouldPopAllStateOnUP(); + Navigation.goBack(ROUTES.HOME, false, true); + } + if (prevReport.parentReportID) { + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(prevReport.parentReportID)); + return; + } Report.navigateToConciergeChat(); return; } @@ -329,7 +337,7 @@ function ReportScreen({ fetchReportIfNeeded(); ComposerActions.setShouldShowComposeInput(true); - }, [route, report, errors, fetchReportIfNeeded, prevReport.reportID, prevUserLeavingStatus, userLeavingStatus, prevReport.statusNum]); + }, [route, report, errors, fetchReportIfNeeded, prevReport.reportID, prevUserLeavingStatus, userLeavingStatus, prevReport.statusNum, prevReport.parentReportID]); useEffect(() => { // Ensures subscription event succeeds when the report/workspace room is created optimistically.