From 3637782e60bda38226dd578b36fe4dd860e21dd0 Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Tue, 26 Mar 2024 14:37:23 +0100 Subject: [PATCH] add isSmallScreenWidth --- src/pages/home/ReportScreen.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx index 9bc0c4c3a4a8..b026fcba9e76 100644 --- a/src/pages/home/ReportScreen.tsx +++ b/src/pages/home/ReportScreen.tsx @@ -429,12 +429,13 @@ function ReportScreen({ // If a user has chosen to leave a thread, and then returns to it (e.g. with the back button), we need to call `openReport` again in order to allow the user to rejoin and to receive real-time updates useEffect(() => { - if (!isFocused || prevIsFocused || !ReportUtils.isChatThread(report) || report.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN) { + if (!isSmallScreenWidth || !isFocused || prevIsFocused || !ReportUtils.isChatThread(report) || report.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN) { return; } Report.openReport(report.reportID); // We don't want to run this useEffect every time `report` is changed + // Excluding isSmallScreenWidth from the dependency list to prevent re-triggering on screen resize events. // eslint-disable-next-line react-hooks/exhaustive-deps }, [prevIsFocused, report.notificationPreference, isFocused]);