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 require cycle from clearReportNotifications #33254

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import * as Environment from '@libs/Environment/Environment';
import * as ErrorUtils from '@libs/ErrorUtils';
import Log from '@libs/Log';
import Navigation from '@libs/Navigation/Navigation';
import clearReportNotifications from '@libs/Notification/clearReportNotifications';
import LocalNotification from '@libs/Notification/LocalNotification';
import * as OptionsListUtils from '@libs/OptionsListUtils';
import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils';
Expand Down Expand Up @@ -475,8 +474,6 @@ function openReport(
return;
}

clearReportNotifications(reportID);

const optimisticReport = reportActionsExist(reportID)
? {}
: {
Expand Down
20 changes: 10 additions & 10 deletions src/pages/home/ReportScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,17 +291,17 @@ function ReportScreen({
[route],
);

// Clear notifications for the current report when the app is focused
useAppFocusEvent(
useCallback(() => {
// Check if this is the top-most ReportScreen since the Navigator preserves multiple at a time
if (!isTopMostReportId) {
return;
}
// Clear notifications for the current report when it's opened and re-focused
const clearNotifications = useCallback(() => {
// Check if this is the top-most ReportScreen since the Navigator preserves multiple at a time
if (!isTopMostReportId) {
return;
}

clearReportNotifications(report.reportID);
}, [report.reportID, isTopMostReportId]),
);
clearReportNotifications(report.reportID);
}, [report.reportID, isTopMostReportId]);
useEffect(clearNotifications, [clearNotifications]);
useAppFocusEvent(clearNotifications);

useEffect(() => {
Timing.end(CONST.TIMING.CHAT_RENDER);
Expand Down
Loading