fix: project automation settings flickering (#2680)

* fix: cycle and module sidebar z-index

* fix: project automation settings flickering
This commit is contained in:
Aaryan Khandelwal 2023-11-08 17:34:42 +05:30 committed by GitHub
parent da799b5a63
commit df8bdfd5b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 156 additions and 157 deletions

View file

@ -1,6 +1,6 @@
import React, { ReactElement } from "react";
import { useRouter } from "next/router";
import useSWR, { mutate } from "swr";
import useSWR from "swr";
// services
import { ProjectService } from "services/project";
// layouts
@ -17,7 +17,7 @@ import { ProjectSettingHeader } from "components/headers";
import { NextPageWithLayout } from "types/app";
import { IProject } from "types";
// constant
import { PROJECTS_LIST, PROJECT_DETAILS, USER_PROJECT_VIEW } from "constants/fetch-keys";
import { USER_PROJECT_VIEW } from "constants/fetch-keys";
// services
const projectService = new ProjectService();
@ -41,18 +41,6 @@ const AutomationSettingsPage: NextPageWithLayout = () => {
const handleChange = async (formData: Partial<IProject>) => {
if (!workspaceSlug || !projectId || !projectDetails) return;
mutate<IProject>(
PROJECT_DETAILS(projectId as string),
(prevData) => ({ ...(prevData as IProject), ...formData }),
false
);
mutate<IProject[]>(
PROJECTS_LIST(workspaceSlug as string, { is_favorite: "all" }),
(prevData) => (prevData ?? []).map((p) => (p.id === projectDetails.id ? { ...p, ...formData } : p)),
false
);
await projectService
.updateProject(workspaceSlug as string, projectId as string, formData, user)
.then(() => {})
@ -72,8 +60,8 @@ const AutomationSettingsPage: NextPageWithLayout = () => {
<div className="flex items-center py-3.5 border-b border-custom-border-100">
<h3 className="text-xl font-medium">Automations</h3>
</div>
<AutoArchiveAutomation projectDetails={projectDetails} handleChange={handleChange} disabled={!isAdmin} />
<AutoCloseAutomation projectDetails={projectDetails} handleChange={handleChange} disabled={!isAdmin} />
<AutoArchiveAutomation handleChange={handleChange} />
<AutoCloseAutomation handleChange={handleChange} />
</section>
);
};