fix: all issues values not changeable and assignee image not rendering (#2707)

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

* chore: removed console log
This commit is contained in:
sabith-tu 2023-11-08 17:56:09 +05:30 committed by GitHub
parent f8002852e0
commit faaba45e59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 9 deletions

View File

@ -49,7 +49,7 @@ export const IssuePropertyAssignee: React.FC<IIssuePropertyAssignee> = observer(
const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null); const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);
const [isLoading, setIsLoading] = useState<Boolean>(false); const [isLoading, setIsLoading] = useState<Boolean>(false);
const projectMembers = projectId ? projectStore?.members?.[projectId] : undefined; const workspaceMembers = workspaceSlug ? workspaceStore?.workspaceMembers : undefined;
const fetchProjectMembers = () => { const fetchProjectMembers = () => {
setIsLoading(true); setIsLoading(true);
@ -59,7 +59,13 @@ export const IssuePropertyAssignee: React.FC<IIssuePropertyAssignee> = observer(
projectStore.fetchProjectMembers(workspaceSlug, projectId).then(() => setIsLoading(false)); 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, value: member.member.id,
query: member.member.display_name, query: member.member.display_name,
content: ( content: (
@ -78,7 +84,7 @@ export const IssuePropertyAssignee: React.FC<IIssuePropertyAssignee> = observer(
tooltipHeading="Assignee" tooltipHeading="Assignee"
tooltipContent={ tooltipContent={
value && value.length > 0 value && value.length > 0
? (projectMembers ? projectMembers : []) ? (workspaceMembers ? workspaceMembers : [])
?.filter((m) => value.includes(m.member.display_name)) ?.filter((m) => value.includes(m.member.display_name))
.map((m) => m.member.display_name) .map((m) => m.member.display_name)
.join(", ") .join(", ")
@ -90,10 +96,8 @@ export const IssuePropertyAssignee: React.FC<IIssuePropertyAssignee> = observer(
{value && value.length > 0 && Array.isArray(value) ? ( {value && value.length > 0 && Array.isArray(value) ? (
<AvatarGroup showTooltip={false}> <AvatarGroup showTooltip={false}>
{value.map((assigneeId) => { {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; if (!member) return null;
return <Avatar key={member.id} name={member.display_name} src={member.avatar} />; return <Avatar key={member.id} name={member.display_name} src={member.avatar} />;
})} })}
</AvatarGroup> </AvatarGroup>
@ -134,7 +138,7 @@ export const IssuePropertyAssignee: React.FC<IIssuePropertyAssignee> = observer(
className={`flex items-center justify-between gap-1 w-full text-xs ${ 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" disabled ? "cursor-not-allowed text-custom-text-200" : "cursor-pointer hover:bg-custom-background-80"
} ${buttonClassName}`} } ${buttonClassName}`}
onClick={() => !projectMembers && fetchProjectMembers()} onClick={() => !workspaceMembers && fetchWorkspaceMembers()}
> >
{label} {label}
{!hideDropdownArrow && !disabled && <ChevronDown className="h-3 w-3" aria-hidden="true" />} {!hideDropdownArrow && !disabled && <ChevronDown className="h-3 w-3" aria-hidden="true" />}

View File

@ -68,14 +68,14 @@ export const GlobalViewLayoutRoot: React.FC<Props> = observer((props) => {
const handleUpdateIssue = useCallback( const handleUpdateIssue = useCallback(
(issue: IIssue, data: Partial<IIssue>) => { (issue: IIssue, data: Partial<IIssue>) => {
if (!workspaceSlug || !globalViewId) return; if (!workspaceSlug) return;
const payload = { const payload = {
...issue, ...issue,
...data, ...data,
}; };
globalViewIssuesStore.updateIssueStructure(globalViewId.toString(), payload); globalViewIssuesStore.updateIssueStructure(type ?? globalViewId!.toString(), payload);
issueDetailStore.updateIssue(workspaceSlug.toString(), issue.project, issue.id, data); issueDetailStore.updateIssue(workspaceSlug.toString(), issue.project, issue.id, data);
}, },
[globalViewId, globalViewIssuesStore, workspaceSlug, issueDetailStore] [globalViewId, globalViewIssuesStore, workspaceSlug, issueDetailStore]