Skip to content

Commit

Permalink
Merge pull request #3401 from ever-co/3394-bug-task-details-page--app…
Browse files Browse the repository at this point in the history
…-crash-on-visiting-task-page

[Fix bug] Task detail page crashes
  • Loading branch information
evereq authored Dec 8, 2024
2 parents 61170ae + 2d92f32 commit 87af1f5
Showing 1 changed file with 16 additions and 20 deletions.
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

0 comments on commit 87af1f5

Please sign in to comment.