From 2fc45d1b3e5319481ffe7fbaca7d0621fe9111d9 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 2 Aug 2024 21:47:48 +0800 Subject: [PATCH 1/2] fix chat doesn't scroll to bottom when adding message while linked to an old message --- src/pages/home/report/ReportActionsList.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionsList.tsx b/src/pages/home/report/ReportActionsList.tsx index 12d886cd30f9..384f916d91aa 100644 --- a/src/pages/home/report/ReportActionsList.tsx +++ b/src/pages/home/report/ReportActionsList.tsx @@ -351,7 +351,11 @@ function ReportActionsList({ (isFromCurrentUser: boolean) => { // If a new comment is added and it's from the current user scroll to the bottom otherwise leave the user positioned where // they are now in the list. - if (!isFromCurrentUser || !hasNewestReportActionRef.current) { + if (!isFromCurrentUser) { + return; + } + if (!hasNewestReportActionRef.current) { + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.reportID)); return; } InteractionManager.runAfterInteractions(() => reportScrollManager.scrollToBottom()); From 2fc9ebcd80bac9abecf275c6d5f4cd3e904cf0d4 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 2 Aug 2024 22:07:58 +0800 Subject: [PATCH 2/2] add missing deps --- src/pages/home/report/ReportActionsList.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionsList.tsx b/src/pages/home/report/ReportActionsList.tsx index 384f916d91aa..8681342a498c 100644 --- a/src/pages/home/report/ReportActionsList.tsx +++ b/src/pages/home/report/ReportActionsList.tsx @@ -360,7 +360,7 @@ function ReportActionsList({ } InteractionManager.runAfterInteractions(() => reportScrollManager.scrollToBottom()); }, - [reportScrollManager], + [reportScrollManager, report.reportID], ); useEffect(() => { // Why are we doing this, when in the cleanup of the useEffect we are already calling the unsubscribe function?