Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix chat get marked as read when opened from a notification #47801

Merged
merged 14 commits into from
Aug 28, 2024
6 changes: 3 additions & 3 deletions src/pages/home/report/ReportActionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,11 @@ function ReportActionsList({
}

if (ReportUtils.isUnread(report)) {
// On desktop, when the notification center is displayed, Visibility.isVisible() will return false.
// On desktop, when the notification center is displayed, isVisible will return false.
// Currently, there's no programmatic way to dismiss the notification center panel.
// To handle this, we use the 'referrer' parameter to check if the current navigation is triggered from a notification.
const isFromNotification = route?.params?.referrer === CONST.REFERRER.NOTIFICATION;
if ((Visibility.isVisible() || isFromNotification) && scrollingVerticalOffset.current < MSG_VISIBLE_THRESHOLD) {
if ((isVisible || isFromNotification) && scrollingVerticalOffset.current < MSG_VISIBLE_THRESHOLD) {
Report.readNewestAction(report.reportID);
if (isFromNotification) {
Navigation.setParams({referrer: undefined});
Expand All @@ -347,7 +347,7 @@ function ReportActionsList({
}
}
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [report.lastVisibleActionCreated, report.reportID]);
}, [report.lastVisibleActionCreated, report.reportID, isVisible]);

useEffect(() => {
if (linkedReportActionID) {
Expand Down
Loading