mirror of
https://github.com/makeplane/plane.git
synced 2026-07-13 22:09:12 +02:00
fix: active cycle mutation (#714)
This commit is contained in:
committed by
GitHub
parent
146419d977
commit
de4c06d108
@@ -3,6 +3,7 @@
|
||||
import { useState } from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { useParams, useSearchParams } from "next/navigation";
|
||||
import { mutate } from "swr";
|
||||
// types
|
||||
import { ICycle } from "@plane/types";
|
||||
// ui
|
||||
@@ -51,6 +52,17 @@ export const CycleDeleteModal: React.FC<ICycleDelete> = observer((props) => {
|
||||
eventName: CYCLE_DELETED,
|
||||
payload: { ...cycle, state: "SUCCESS" },
|
||||
});
|
||||
|
||||
// NOTE: This operation is for enterprise edition only
|
||||
mutate("WORKSPACE_ACTIVE_CYCLES_LIST_EMPTY-WORKSPACE_100:0:0_100", (data: any) => {
|
||||
if (!data || !Array.isArray(data?.results)) {
|
||||
return data;
|
||||
}
|
||||
return {
|
||||
...data,
|
||||
results: data?.results?.filter((c: any) => c?.id !== cycle.id),
|
||||
};
|
||||
});
|
||||
})
|
||||
.catch((errors) => {
|
||||
const isPermissionError = errors?.error === "Only admin or owner can delete the cycle";
|
||||
|
||||
Reference in New Issue
Block a user