chore: Active cycle muatation when current cycle creation when current_date is in between start_date and end_date (#5050)
This commit is contained in:
parent
a36d1a753e
commit
156f1011f3
2 changed files with 12 additions and 1 deletions
|
|
@ -98,4 +98,4 @@ const ProjectCyclesPage = observer(() => {
|
|||
);
|
||||
});
|
||||
|
||||
export default ProjectCyclesPage;
|
||||
export default ProjectCyclesPage;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
"use client";
|
||||
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { mutate } from "swr";
|
||||
// types
|
||||
import type { CycleDateCheckData, ICycle, TCycleTabOptions } from "@plane/types";
|
||||
// ui
|
||||
|
|
@ -43,6 +44,16 @@ export const CycleCreateUpdateModal: React.FC<CycleModalProps> = (props) => {
|
|||
const selectedProjectId = payload.project_id ?? projectId.toString();
|
||||
await createCycle(workspaceSlug, selectedProjectId, payload)
|
||||
.then((res) => {
|
||||
// mutate when the current cycle creation is active
|
||||
if (payload.start_date && payload.end_date) {
|
||||
const currentDate = new Date();
|
||||
const cycleStartDate = new Date(payload.start_date);
|
||||
const cycleEndDate = new Date(payload.end_date);
|
||||
if (currentDate >= cycleStartDate && currentDate <= cycleEndDate) {
|
||||
mutate(`PROJECT_ACTIVE_CYCLE_${selectedProjectId}`);
|
||||
}
|
||||
}
|
||||
|
||||
setToast({
|
||||
type: TOAST_TYPE.SUCCESS,
|
||||
title: "Success!",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue