diff --git a/web/core/store/cycle.store.ts b/web/core/store/cycle.store.ts index 55f7c2278a..b9a7b01f1b 100644 --- a/web/core/store/cycle.store.ts +++ b/web/core/store/cycle.store.ts @@ -489,16 +489,13 @@ export class CycleStore implements ICycleStore { * @param cycleId * @returns */ - fetchActiveCycleProgress = async (workspaceSlug: string, projectId: string, cycleId: string) => { - this.progressLoader = true; - return await this.cycleService.workspaceActiveCyclesProgress(workspaceSlug, projectId, cycleId).then((progress) => { + fetchActiveCycleProgress = async (workspaceSlug: string, projectId: string, cycleId: string) => + await this.cycleService.workspaceActiveCyclesProgress(workspaceSlug, projectId, cycleId).then((progress) => { runInAction(() => { set(this.cycleMap, [cycleId], { ...this.cycleMap[cycleId], ...progress }); - this.progressLoader = false; }); return progress; }); - }; /** * @description fetches active cycle progress for pro users @@ -522,8 +519,9 @@ export class CycleStore implements ICycleStore { projectId: string, cycleId: string, analytic_type: string - ) => - await this.cycleService + ) => { + set(this.cycleMap, [cycleId, analytic_type === "points" ? "estimate_distribution" : "distribution"], null); + return await this.cycleService .workspaceActiveCyclesAnalytics(workspaceSlug, projectId, cycleId, analytic_type) .then((cycle) => { runInAction(() => { @@ -531,7 +529,7 @@ export class CycleStore implements ICycleStore { }); return cycle; }); - + }; /** * @description fetches cycle details * @param workspaceSlug @@ -608,9 +606,6 @@ export class CycleStore implements ICycleStore { */ updateCycleDetails = async (workspaceSlug: string, projectId: string, cycleId: string, data: Partial) => { try { - runInAction(() => { - set(this.cycleMap, [cycleId], { ...this.cycleMap?.[cycleId], ...data }); - }); const response = await this.cycleService.patchCycle(workspaceSlug, projectId, cycleId, data); this.fetchCycleDetails(workspaceSlug, projectId, cycleId); return response; diff --git a/web/ee/components/cycles/active-cycle/base.tsx b/web/ee/components/cycles/active-cycle/base.tsx index 6d4f090324..2dfd0c29c5 100644 --- a/web/ee/components/cycles/active-cycle/base.tsx +++ b/web/ee/components/cycles/active-cycle/base.tsx @@ -50,7 +50,6 @@ export const ActiveCycleBase: React.FC = observer((props) = projectId={projectId} cycleId={cycleDetails.cycle?.id || " "} workspaceSlug={workspaceSlug} - progressLoader={cycleDetails.progressLoader} />
diff --git a/web/ee/components/cycles/active-cycle/cycle-chart/ticks.tsx b/web/ee/components/cycles/active-cycle/cycle-chart/ticks.tsx index d8d1601c89..dfb133473f 100644 --- a/web/ee/components/cycles/active-cycle/cycle-chart/ticks.tsx +++ b/web/ee/components/cycles/active-cycle/cycle-chart/ticks.tsx @@ -1,4 +1,4 @@ -import { startOfToday, format } from "date-fns"; +import { startOfToday, format, differenceInWeeks } from "date-fns"; import { TCycleProgress } from "@plane/types"; import { TProgressChartData } from "@/helpers/cycle.helper"; @@ -33,6 +33,7 @@ const CustomizedXAxisTicks = (props: TProps) => { const isStart = payload.value === startDate; const isEnd = payload.value === endDate; const isToday = payload.value === format(startOfToday(), "yyyy-MM-dd"); + const weeks = endDate && startDate ? differenceInWeeks(endDate, startDate) : 4; if (!data || !endDate) return null; @@ -62,7 +63,10 @@ const CustomizedXAxisTicks = (props: TProps) => { const shouldShowThisTick = () => (data.length < 10 && showAllTicks) || - (payload.index !== 0 && payload.index % 7 === 0 && !areAdjacentTicksVisible(payload) && showAllTicks) || + (payload.index !== 0 && + payload.index % (weeks * 2 - 1) === 0 && + !areAdjacentTicksVisible(payload) && + showAllTicks) || shouldShowTick(data[payload.index]); if (!shouldShowThisTick()) return null; diff --git a/web/ee/components/cycles/active-cycle/details.tsx b/web/ee/components/cycles/active-cycle/details.tsx index 99e0393ce6..1c99689d58 100644 --- a/web/ee/components/cycles/active-cycle/details.tsx +++ b/web/ee/components/cycles/active-cycle/details.tsx @@ -86,7 +86,7 @@ const ActiveCycleDetail = observer((props: ActiveCycleDetailProps) => { })} >
- {cycleProgress !== null ? ( + {cycleProgress !== null && !progressLoader ? (
{ data={cycleProgress} estimateType={computedEstimateType} plotType={computedPlotType} - progressLoader={progressLoader} handleFiltersUpdate={handleFiltersUpdate} parentWidth={containerWidth} /> diff --git a/web/ee/components/cycles/active-cycle/formatter.ts b/web/ee/components/cycles/active-cycle/formatter.ts index f19e7ca68f..4de87e6e15 100644 --- a/web/ee/components/cycles/active-cycle/formatter.ts +++ b/web/ee/components/cycles/active-cycle/formatter.ts @@ -22,7 +22,8 @@ const formatV1Data = (isTypeIssue: boolean, cycle: ICycle, isBurnDown: boolean, const pending = data.completion_chart[p] || 0; const total = (isTypeIssue ? cycle.total_issues : cycle.total_estimate_points) || 0; const completed = total - pending; - const idealDone = ideal(p, total, cycle); + const idealDone = ideal(p, total, cycle) || 0; + return { date: p, scope: p! <= cycle.end_date! ? total : null, diff --git a/web/ee/components/cycles/active-cycle/progress-header.tsx b/web/ee/components/cycles/active-cycle/progress-header.tsx index bc0397b750..89997cdf55 100644 --- a/web/ee/components/cycles/active-cycle/progress-header.tsx +++ b/web/ee/components/cycles/active-cycle/progress-header.tsx @@ -18,7 +18,6 @@ type Props = { projectId: string; cycleId: string; cycleDetails: ICycle; - progressLoader: boolean; }; export const CycleProgressHeader: FC = (props: Props) => { diff --git a/web/ee/components/cycles/active-cycle/summary.tsx b/web/ee/components/cycles/active-cycle/summary.tsx index 8b17f747fe..b2442ace37 100644 --- a/web/ee/components/cycles/active-cycle/summary.tsx +++ b/web/ee/components/cycles/active-cycle/summary.tsx @@ -15,7 +15,6 @@ type Props = { data: Partial[] | null; plotType: string; estimateType: string; - progressLoader?: boolean; handleFiltersUpdate: (key: keyof IIssueFilterOptions, value: string[], redirect?: boolean) => void; parentWidth?: number; }; diff --git a/web/ee/components/cycles/active-cycle/use-cycle-details.ts b/web/ee/components/cycles/active-cycle/use-cycle-details.ts index 118a36f971..c7c0c609cb 100644 --- a/web/ee/components/cycles/active-cycle/use-cycle-details.ts +++ b/web/ee/components/cycles/active-cycle/use-cycle-details.ts @@ -47,7 +47,7 @@ const useCycleDetails = (props: IActiveCycleDetails) => { // fetches cycle details for non-pro users useSWR( workspaceSlug && projectId && cycle?.id && cycle?.version === 1 - ? `PROJECT_ACTIVE_CYCLE_${projectId}_PROGRESS` + ? `PROJECT_ACTIVE_CYCLE_${projectId}_PROGRESS_${cycle.start_date}_${cycle.end_date}` : null, workspaceSlug && projectId && cycle?.id && cycle?.version === 1 ? () => fetchActiveCycleProgress(workspaceSlug, projectId, cycle.id) @@ -56,26 +56,28 @@ const useCycleDetails = (props: IActiveCycleDetails) => { ); // fetches cycle details for non-pro users useSWR( - workspaceSlug && projectId && cycle?.id && !cycle?.distribution && cycle?.version === 1 - ? `PROJECT_ACTIVE_CYCLE_${projectId}_DURATION` + workspaceSlug && projectId && cycle?.id && cycle?.version === 1 + ? `PROJECT_ACTIVE_CYCLE_${projectId}_DURATION_${cycle.start_date}_${cycle.end_date}` : null, - workspaceSlug && projectId && cycle?.id && !cycle?.distribution && cycle?.version === 1 + workspaceSlug && projectId && cycle?.id && cycle?.version === 1 ? () => fetchActiveCycleAnalytics(workspaceSlug, projectId, cycle.id, "issues") - : null + : null, + { revalidateIfStale: false, revalidateOnFocus: false } ); // fetches cycle details for non-pro users useSWR( - workspaceSlug && projectId && cycle?.id && !cycle?.estimate_distribution && cycle?.version === 1 - ? `PROJECT_ACTIVE_CYCLE_${projectId}_ESTIMATE_DURATION` + workspaceSlug && projectId && cycle?.id && cycle?.version === 1 + ? `PROJECT_ACTIVE_CYCLE_${projectId}_ESTIMATE_DURATION_${cycle.start_date}_${cycle.end_date}` : null, - workspaceSlug && projectId && cycle?.id && !cycle?.estimate_distribution && cycle?.version === 1 + workspaceSlug && projectId && cycle?.id && cycle?.version === 1 ? () => fetchActiveCycleAnalytics(workspaceSlug, projectId, cycle.id, "points") - : null + : null, + { revalidateIfStale: false, revalidateOnFocus: false } ); // fetches cycle details for pro users useSWR( workspaceSlug && projectId && cycleId && cycle?.version === 2 - ? `PROJECT_ACTIVE_CYCLE_${projectId}_PROGRESS_PRO` + ? `PROJECT_ACTIVE_CYCLE_${projectId}_PROGRESS_PRO_${cycle.start_date}_${cycle.end_date}` : null, workspaceSlug && projectId && cycleId && cycle?.version === 2 ? () => fetchActiveCycleProgressPro(workspaceSlug, projectId, cycleId) diff --git a/yarn.lock b/yarn.lock index a0414fea9c..456ba47e50 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14190,4 +14190,4 @@ zod@^3.22.2, zod@^3.23.8, zod@^3.24.1: zxcvbn@^4.4.2: version "4.4.2" resolved "https://registry.npmjs.org/zxcvbn/-/zxcvbn-4.4.2.tgz#28ec17cf09743edcab056ddd8b1b06262cc73c30" - integrity sha512-Bq0B+ixT/DMyG8kgX2xWcI5jUvCwqrMxSFam7m0lAf78nf04hv6lNCsyLYdyYTrCVMqNDY/206K7eExYCeSyUQ== + integrity sha512-Bq0B+ixT/DMyG8kgX2xWcI5jUvCwqrMxSFam7m0lAf78nf04hv6lNCsyLYdyYTrCVMqNDY/206K7eExYCeSyUQ== \ No newline at end of file