fix: empty module mutation and issue view flicker fix (#1158)

This commit is contained in:
Anmol Singh Bhatia 2023-05-29 18:35:43 +05:30 committed by GitHub
parent c8caa925b1
commit c949c4d244
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 42 deletions

View File

@ -186,7 +186,7 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = ({
mutate<IIssue>(PROJECT_ISSUES_DETAILS, (prevData) => ({ ...prevData, ...res }), false); mutate<IIssue>(PROJECT_ISSUES_DETAILS, (prevData) => ({ ...prevData, ...res }), false);
} else { } else {
if (issueView === "calendar") mutate(calendarFetchKey); if (issueView === "calendar") mutate(calendarFetchKey);
else mutate(PROJECT_ISSUES_LIST_WITH_PARAMS(activeProject ?? "", params)); mutate(PROJECT_ISSUES_LIST_WITH_PARAMS(activeProject ?? "", params));
} }
if (payload.cycle && payload.cycle !== "") addIssueToCycle(res.id, payload.cycle); if (payload.cycle && payload.cycle !== "") addIssueToCycle(res.id, payload.cycle);

View File

@ -190,6 +190,19 @@ export const reducer: ReducerFunctionType = (state, action) => {
}; };
const saveDataToServer = async (workspaceSlug: string, projectID: string, state: any) => { const saveDataToServer = async (workspaceSlug: string, projectID: string, state: any) => {
mutate<IProjectMember>(
workspaceSlug && projectID ? USER_PROJECT_VIEW(projectID as string) : null,
(prevData) => {
if (!prevData) return prevData;
return {
...prevData,
view_props: state,
};
},
false
);
await projectService.setProjectView(workspaceSlug, projectID, { await projectService.setProjectView(workspaceSlug, projectID, {
view_props: state, view_props: state,
}); });

View File

@ -172,47 +172,15 @@ const SingleModule: React.FC = () => {
} }
> >
<AnalyticsProjectModal isOpen={analyticsModal} onClose={() => setAnalyticsModal(false)} /> <AnalyticsProjectModal isOpen={analyticsModal} onClose={() => setAnalyticsModal(false)} />
{moduleIssues ? (
moduleIssues.length > 0 ? ( <div
<div className={`h-full ${moduleSidebar ? "mr-[24rem]" : ""} duration-300`}> className={`h-full ${moduleSidebar ? "mr-[24rem]" : ""} ${
<IssuesView type="module" openIssuesListModal={openIssuesListModal} /> analyticsModal ? "mr-[50%]" : ""
</div> } duration-300`}
) : ( >
<div <IssuesView type="module" openIssuesListModal={openIssuesListModal} />
className={`flex h-full flex-col items-center justify-center px-4 ${ </div>
moduleSidebar ? "mr-[24rem]" : ""
} duration-300`}
>
<EmptySpace
title="You don't have any issue yet."
description="Modules are smaller, focused projects that help you group and organize issues within a specific time frame."
Icon={RectangleStackIcon}
>
<EmptySpaceItem
title="Create a new issue"
description="Click to create a new issue inside the module."
Icon={PlusIcon}
action={() => {
const e = new KeyboardEvent("keydown", {
key: "c",
});
document.dispatchEvent(e);
}}
/>
<EmptySpaceItem
title="Add an existing issue"
description="Open list"
Icon={ListBulletIcon}
action={openIssuesListModal}
/>
</EmptySpace>
</div>
)
) : (
<div className="flex h-full w-full items-center justify-center">
<Spinner />
</div>
)}
<ModuleDetailsSidebar <ModuleDetailsSidebar
issues={moduleIssues ?? []} issues={moduleIssues ?? []}
module={moduleDetails} module={moduleDetails}