Skip to content

Commit

Permalink
fix: all issues values not changeable and assignee image not rendering (
Browse files Browse the repository at this point in the history
makeplane#2707)

* fix: all issues values are not changeable and assignee image not rendering

* chore: removed console log
  • Loading branch information
sabith-tu authored Nov 8, 2023
1 parent f800285 commit faaba45
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
18 changes: 11 additions & 7 deletions web/components/issues/issue-layouts/properties/assignee.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const IssuePropertyAssignee: React.FC<IIssuePropertyAssignee> = observer(
const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);
const [isLoading, setIsLoading] = useState<Boolean>(false);

const projectMembers = projectId ? projectStore?.members?.[projectId] : undefined;
const workspaceMembers = workspaceSlug ? workspaceStore?.workspaceMembers : undefined;

const fetchProjectMembers = () => {
setIsLoading(true);
Expand All @@ -59,7 +59,13 @@ export const IssuePropertyAssignee: React.FC<IIssuePropertyAssignee> = 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: (
Expand All @@ -78,7 +84,7 @@ export const IssuePropertyAssignee: React.FC<IIssuePropertyAssignee> = 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(", ")
Expand All @@ -90,10 +96,8 @@ export const IssuePropertyAssignee: React.FC<IIssuePropertyAssignee> = observer(
{value && value.length > 0 && Array.isArray(value) ? (
<AvatarGroup showTooltip={false}>
{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 <Avatar key={member.id} name={member.display_name} src={member.avatar} />;
})}
</AvatarGroup>
Expand Down Expand Up @@ -134,7 +138,7 @@ export const IssuePropertyAssignee: React.FC<IIssuePropertyAssignee> = 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 && <ChevronDown className="h-3 w-3" aria-hidden="true" />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ export const GlobalViewLayoutRoot: React.FC<Props> = observer((props) => {

const handleUpdateIssue = useCallback(
(issue: IIssue, data: Partial<IIssue>) => {
if (!workspaceSlug || !globalViewId) return;
if (!workspaceSlug) return;

const payload = {
...issue,
...data,
};

globalViewIssuesStore.updateIssueStructure(globalViewId.toString(), payload);
globalViewIssuesStore.updateIssueStructure(type ?? globalViewId!.toString(), payload);
issueDetailStore.updateIssue(workspaceSlug.toString(), issue.project, issue.id, data);
},
[globalViewId, globalViewIssuesStore, workspaceSlug, issueDetailStore]
Expand Down

0 comments on commit faaba45

Please sign in to comment.