Skip to content

Commit 156f101

Browse files
authored
chore: Active cycle muatation when current cycle creation when current_date is in between start_date and end_date (#5050)
1 parent a36d1a7 commit 156f101

File tree

2 files changed

+12
-1
lines changed
  • web
    • app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(list)
    • core/components/cycles

2 files changed

+12
-1
lines changed

web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(list)/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,4 @@ const ProjectCyclesPage = observer(() => {
9898
);
9999
});
100100

101-
export default ProjectCyclesPage;
101+
export default ProjectCyclesPage;

web/core/components/cycles/modal.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use client";
22

33
import React, { useEffect, useState } from "react";
4+
import { mutate } from "swr";
45
// types
56
import type { CycleDateCheckData, ICycle, TCycleTabOptions } from "@plane/types";
67
// ui
@@ -43,6 +44,16 @@ export const CycleCreateUpdateModal: React.FC<CycleModalProps> = (props) => {
4344
const selectedProjectId = payload.project_id ?? projectId.toString();
4445
await createCycle(workspaceSlug, selectedProjectId, payload)
4546
.then((res) => {
47+
// mutate when the current cycle creation is active
48+
if (payload.start_date && payload.end_date) {
49+
const currentDate = new Date();
50+
const cycleStartDate = new Date(payload.start_date);
51+
const cycleEndDate = new Date(payload.end_date);
52+
if (currentDate >= cycleStartDate && currentDate <= cycleEndDate) {
53+
mutate(`PROJECT_ACTIVE_CYCLE_${selectedProjectId}`);
54+
}
55+
}
56+
4657
setToast({
4758
type: TOAST_TYPE.SUCCESS,
4859
title: "Success!",

0 commit comments

Comments
 (0)