Skip to content

Commit

Permalink
return early if options are not initialized yet
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardoj committed Jun 22, 2024
1 parent b021195 commit fea92b5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pages/workspace/WorkspaceInvitePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ function WorkspaceInvitePage({route, betas, invitedEmailsToAccountIDsDraft, poli
const excludedUsers = useMemo(() => PolicyUtils.getIneligibleInvitees(policy?.employeeList), [policy?.employeeList]);

useEffect(() => {
if (!areOptionsInitialized) {
return;
}

const newUsersToInviteDict: Record<number, OptionData> = {};
const newPersonalDetailsDict: Record<number, OptionData> = {};
const newSelectedOptionsDict: Record<number, MemberForList> = {};
Expand Down Expand Up @@ -154,7 +158,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, debouncedSearchTerm, excludedUsers]);
}, [options.personalDetails, policy?.employeeList, betas, debouncedSearchTerm, excludedUsers, areOptionsInitialized]);

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

0 comments on commit fea92b5

Please sign in to comment.