Skip to content

Commit

Permalink
updating workspace invite member page: useEffect dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
brunovjk committed Apr 17, 2024
1 parent 508da04 commit 1e651e7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/pages/ChatFinderPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ function ChatFinderPage({betas, isSearchingForReports, navigation}: ChatFinderPa
onSelectRow={selectReport}
showLoadingPlaceholder={!areOptionsInitialized || !isScreenTransitionEnd}
footerContent={!isDismissed && ChatFinderPageFooterInstance}
isLoadingNewOptions={isSearchingForReports ?? undefined}
isLoadingNewOptions={!!isSearchingForReports}
/>
</ScreenWrapper>
);
Expand Down
3 changes: 2 additions & 1 deletion src/pages/RoomInvitePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ function RoomInvitePage({

useEffect(() => {
setSearchTerm(SearchInputManager.searchInput);
}, [setSearchTerm]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

// Any existing participants and Expensify emails should not be eligible for invitation
const excludedUsers = useMemo(
Expand Down
2 changes: 1 addition & 1 deletion src/pages/tasks/TaskShareDestinationSelectorModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function TaskShareDestinationSelectorModal({isSearchingForReports}: TaskShareDes
headerMessage={options.headerMessage}
textInputLabel={translate('optionsSelector.nameEmailOrPhoneNumber')}
showLoadingPlaceholder={areOptionsInitialized && debouncedSearchValue.trim() === '' ? options.sections.length === 0 : !didScreenTransitionEnd}
isLoadingNewOptions={isSearchingForReports ?? undefined}
isLoadingNewOptions={!!isSearchingForReports}
textInputHint={textInputHint}
/>
</View>
Expand Down
7 changes: 4 additions & 3 deletions src/pages/workspace/WorkspaceInvitePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ function WorkspaceInvitePage({route, betas, invitedEmailsToAccountIDsDraft, poli
return () => {
Policy.setWorkspaceInviteMembersDraft(route.params.policyID, {});
};
}, [setSearchTerm, route.params.policyID]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [route.params.policyID]);

useEffect(() => {
Policy.clearErrors(route.params.policyID);
Expand All @@ -96,7 +97,7 @@ function WorkspaceInvitePage({route, betas, invitedEmailsToAccountIDsDraft, poli
const newSelectedOptionsDict: Record<number, MemberForList> = {};

const inviteOptions = OptionsListUtils.getMemberInviteOptions(options.personalDetails, betas ?? [], debouncedSearchTerm, excludedUsers, true);
// Update selectedOptions with the latest personalDetails and policyMembers information
// Update selectedOptions with the latest personalDetails and policyEmployeeList information
const detailsMap: Record<string, MemberForList> = {};
inviteOptions.personalDetails.forEach((detail) => {
if (!detail.login) {
Expand Down Expand Up @@ -146,7 +147,7 @@ function WorkspaceInvitePage({route, betas, invitedEmailsToAccountIDsDraft, poli
setSelectedOptions(Object.values(newSelectedOptionsDict));

// eslint-disable-next-line react-hooks/exhaustive-deps -- we don't want to recalculate when selectedOptions change
}, [options.personalDetails, policy?.employeeList, betas, searchTerm, excludedUsers]);
}, [options.personalDetails, policy?.employeeList, betas, debouncedSearchTerm, excludedUsers]);

const sections: MembersSection[] = useMemo(() => {
const sectionsArr: MembersSection[] = [];
Expand Down

0 comments on commit 1e651e7

Please sign in to comment.