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 bug] Task detail page crashes #3401

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -220,27 +220,23 @@ const ManageMembersPopover = (memberList: OT_Member[], task: ITeamTask | null) =

const memberInfo = useTeamMemberCard(member);

const unassignedMembers = useMemo(
() =>
memberList.filter((member) =>
member.employee
? !task?.members.map((item) => item.userId).includes(member.employee.userId) &&
member.employee?.isActive
: false
),
[memberList, task?.members]
);
const unassignedMembers = useMemo(() => {
if (!task?.members) return memberList.filter((member) => member.employee?.isActive); // Early return if no task members
const assignedIds = task.members.map((item) => item.userId);

const assignedTaskMembers = useMemo(
() =>
memberList.filter((member) =>
member.employee
? task?.members.map((item) => item.userId).includes(member.employee?.userId) &&
member.employee?.isActive
: false
),
[memberList, task?.members]
);
return memberList.filter(
(member) => member.employee && !assignedIds.includes(member.employee.userId) && member.employee.isActive
);
}, [memberList, task?.members]);

const assignedTaskMembers = useMemo(() => {
if (!task?.members) return []; // Early return if no task members
const assignedIds = task.members.map((item) => item.userId);

return memberList.filter(
(member) => member.employee && assignedIds.includes(member.employee.userId) && member.employee.isActive
);
}, [memberList, task?.members]);

useEffect(() => {
if (task && member && memberToRemove) {
Expand Down
Loading