fix: cycle list page mutation fix (#661)

* fix: cycle list page mutation fix

* fix: cycle mutation fix
This commit is contained in:
Anmol Singh Bhatia 2023-03-31 18:31:21 +05:30 committed by GitHub
parent abe34ad7b1
commit 6055f5c4ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions

View file

@ -77,7 +77,7 @@ export const CreateUpdateCycleModal: React.FC<CycleModalProps> = ({
await cycleService
.updateCycle(workspaceSlug as string, projectId as string, cycleId, payload)
.then((res) => {
switch (getDateRangeStatus(res.start_date, res.end_date)) {
switch (getDateRangeStatus(data?.start_date, data?.end_date)) {
case "completed":
mutate(CYCLE_COMPLETE_LIST(projectId as string));
break;
@ -90,6 +90,25 @@ export const CreateUpdateCycleModal: React.FC<CycleModalProps> = ({
default:
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();
setToastAlert({