forked from github/plane
fix: cycle list page mutation fix (#661)
* fix: cycle list page mutation fix * fix: cycle mutation fix
This commit is contained in:
parent
abe34ad7b1
commit
6055f5c4ee
@ -77,7 +77,7 @@ export const CreateUpdateCycleModal: React.FC<CycleModalProps> = ({
|
|||||||
await cycleService
|
await cycleService
|
||||||
.updateCycle(workspaceSlug as string, projectId as string, cycleId, payload)
|
.updateCycle(workspaceSlug as string, projectId as string, cycleId, payload)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
switch (getDateRangeStatus(res.start_date, res.end_date)) {
|
switch (getDateRangeStatus(data?.start_date, data?.end_date)) {
|
||||||
case "completed":
|
case "completed":
|
||||||
mutate(CYCLE_COMPLETE_LIST(projectId as string));
|
mutate(CYCLE_COMPLETE_LIST(projectId as string));
|
||||||
break;
|
break;
|
||||||
@ -90,6 +90,25 @@ export const CreateUpdateCycleModal: React.FC<CycleModalProps> = ({
|
|||||||
default:
|
default:
|
||||||
mutate(CYCLE_DRAFT_LIST(projectId as string));
|
mutate(CYCLE_DRAFT_LIST(projectId as string));
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
getDateRangeStatus(data?.start_date, data?.end_date) !=
|
||||||
|
getDateRangeStatus(res.start_date, res.end_date)
|
||||||
|
) {
|
||||||
|
switch (getDateRangeStatus(res.start_date, res.end_date)) {
|
||||||
|
case "completed":
|
||||||
|
mutate(CYCLE_COMPLETE_LIST(projectId as string));
|
||||||
|
break;
|
||||||
|
case "current":
|
||||||
|
mutate(CYCLE_CURRENT_AND_UPCOMING_LIST(projectId as string));
|
||||||
|
break;
|
||||||
|
case "upcoming":
|
||||||
|
mutate(CYCLE_CURRENT_AND_UPCOMING_LIST(projectId as string));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
mutate(CYCLE_DRAFT_LIST(projectId as string));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handleClose();
|
handleClose();
|
||||||
|
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
|
@ -89,7 +89,7 @@ export const timeAgo = (time: any) => {
|
|||||||
return time;
|
return time;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getDateRangeStatus = (startDate: string | null, endDate: string | null) => {
|
export const getDateRangeStatus = (startDate: string | null | undefined, endDate: string | null | undefined) => {
|
||||||
if (!startDate || !endDate) return "draft";
|
if (!startDate || !endDate) return "draft";
|
||||||
|
|
||||||
const today = renderDateFormat(new Date());
|
const today = renderDateFormat(new Date());
|
||||||
|
Loading…
Reference in New Issue
Block a user