diff --git a/web/components/issues/issue-layouts/properties/assignee.tsx b/web/components/issues/issue-layouts/properties/assignee.tsx index b436e274f..4c14ccabc 100644 --- a/web/components/issues/issue-layouts/properties/assignee.tsx +++ b/web/components/issues/issue-layouts/properties/assignee.tsx @@ -49,7 +49,7 @@ export const IssuePropertyAssignee: React.FC = observer( const [popperElement, setPopperElement] = useState(null); const [isLoading, setIsLoading] = useState(false); - const projectMembers = projectId ? projectStore?.members?.[projectId] : undefined; + const workspaceMembers = workspaceSlug ? workspaceStore?.workspaceMembers : undefined; const fetchProjectMembers = () => { setIsLoading(true); @@ -59,7 +59,13 @@ export const IssuePropertyAssignee: React.FC = observer( projectStore.fetchProjectMembers(workspaceSlug, projectId).then(() => setIsLoading(false)); }; - const options = (projectMembers ?? [])?.map((member) => ({ + const fetchWorkspaceMembers = () => { + setIsLoading(true); + if (workspaceSlug) + workspaceSlug && workspaceStore.fetchWorkspaceMembers(workspaceSlug).then(() => setIsLoading(false)); + }; + + const options = (workspaceMembers ?? [])?.map((member) => ({ value: member.member.id, query: member.member.display_name, content: ( @@ -78,7 +84,7 @@ export const IssuePropertyAssignee: React.FC = observer( tooltipHeading="Assignee" tooltipContent={ value && value.length > 0 - ? (projectMembers ? projectMembers : []) + ? (workspaceMembers ? workspaceMembers : []) ?.filter((m) => value.includes(m.member.display_name)) .map((m) => m.member.display_name) .join(", ") @@ -90,10 +96,8 @@ export const IssuePropertyAssignee: React.FC = observer( {value && value.length > 0 && Array.isArray(value) ? ( {value.map((assigneeId) => { - const member = projectMembers?.find((m) => m.member.id === assigneeId)?.member; - + const member = workspaceMembers?.find((m) => m.member.id === assigneeId)?.member; if (!member) return null; - return ; })} @@ -134,7 +138,7 @@ export const IssuePropertyAssignee: React.FC = observer( className={`flex items-center justify-between gap-1 w-full text-xs ${ disabled ? "cursor-not-allowed text-custom-text-200" : "cursor-pointer hover:bg-custom-background-80" } ${buttonClassName}`} - onClick={() => !projectMembers && fetchProjectMembers()} + onClick={() => !workspaceMembers && fetchWorkspaceMembers()} > {label} {!hideDropdownArrow && !disabled &&