Skip to content
Merged
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
12 changes: 11 additions & 1 deletion src/pages/ReportParticipantsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import useSearchBackPress from '@hooks/useSearchBackPress';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
import {turnOffMobileSelectionMode} from '@libs/actions/MobileSelectionMode';
import {removeFromGroupChat, updateGroupChatMemberRoles} from '@libs/actions/Report';
import {openRoomMembersPage, removeFromGroupChat, updateGroupChatMemberRoles} from '@libs/actions/Report';
import {clearUserSearchPhrase} from '@libs/actions/RoomMembersUserSearchPhrase';
import Navigation from '@libs/Navigation/Navigation';
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
Expand All @@ -39,6 +39,7 @@ import {getDisplayNameOrDefault, getPersonalDetailsByIDs} from '@libs/PersonalDe
import {getReportName} from '@libs/ReportNameUtils';
import {
getReportPersonalDetailsParticipants,
isAnnounceRoom,
isArchivedNonExpenseReport,
isChatRoom,
isChatThread,
Expand Down Expand Up @@ -133,6 +134,15 @@ function ReportParticipantsPage({report, route}: ReportParticipantsPageProps) {
}
}, [isFocused, setSearchValue, shouldShowTextInput, userSearchPhrase]);

useEffect(() => {
if (!isAnnounceRoom(report)) {
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ CONSISTENCY-5 (docs)

The eslint-disable-next-line react-hooks/exhaustive-deps comment lacks a justification explaining why the dependencies are intentionally omitted. Every ESLint disable should have an accompanying comment so reviewers and future maintainers understand the reasoning.

Add a comment explaining the intent, for example:

useEffect(() => {
    if (!isAnnounceRoom(report)) {
        return;
    }
    openRoomMembersPage(report.reportID);
    // We only want to fetch room members once on mount
    // eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot Fix this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a justification comment: // We only want to fetch room members once on mount, not when report changes

openRoomMembersPage(report.reportID);
// We only want to fetch room members once on mount, not when report changes
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

useSearchBackPress({
onClearSelection: () => setSelectedMembers([]),
onNavigationCallBack: () => {
Expand Down
Loading