From 52395d0563e726e7407cf8930e1af63965702570 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Sat, 4 Nov 2023 01:56:23 +0530 Subject: [PATCH] chore : dropdown loading state added and project card avatar fix (#2643) * chore: project card avatar rendering fix * chore: state, assignee and label dropdown loading state added --- .../issue-layouts/properties/assignee.tsx | 62 +++++++++-------- .../issue-layouts/properties/labels.tsx | 68 ++++++++++--------- .../issues/issue-layouts/properties/state.tsx | 62 +++++++++-------- web/components/project/card.tsx | 2 +- 4 files changed, 102 insertions(+), 92 deletions(-) diff --git a/web/components/issues/issue-layouts/properties/assignee.tsx b/web/components/issues/issue-layouts/properties/assignee.tsx index ee545f3a5..b436e274f 100644 --- a/web/components/issues/issue-layouts/properties/assignee.tsx +++ b/web/components/issues/issue-layouts/properties/assignee.tsx @@ -47,11 +47,17 @@ export const IssuePropertyAssignee: React.FC = observer( const [referenceElement, setReferenceElement] = useState(null); const [popperElement, setPopperElement] = useState(null); + const [isLoading, setIsLoading] = useState(false); const projectMembers = projectId ? projectStore?.members?.[projectId] : undefined; - const fetchProjectMembers = () => - workspaceSlug && projectId && projectStore.fetchProjectMembers(workspaceSlug, projectId); + const fetchProjectMembers = () => { + setIsLoading(true); + if (workspaceSlug && projectId) + workspaceSlug && + projectId && + projectStore.fetchProjectMembers(workspaceSlug, projectId).then(() => setIsLoading(false)); + }; const options = (projectMembers ?? [])?.map((member) => ({ value: member.member.id, @@ -128,7 +134,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={() => fetchProjectMembers()} + onClick={() => !projectMembers && fetchProjectMembers()} > {label} {!hideDropdownArrow && !disabled &&