forked from github/plane
fix: cycle delete & active cycle loading (#3088)
This commit is contained in:
parent
6c61fbd102
commit
4bb99d5fbf
@ -75,7 +75,7 @@ export const ActiveCycleDetails: React.FC<IActiveCycleDetails> = observer((props
|
|||||||
|
|
||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
|
|
||||||
useSWR(
|
const { isLoading } = useSWR(
|
||||||
workspaceSlug && projectId ? `ACTIVE_CYCLE_ISSUE_${projectId}_CURRENT` : null,
|
workspaceSlug && projectId ? `ACTIVE_CYCLE_ISSUE_${projectId}_CURRENT` : null,
|
||||||
workspaceSlug && projectId ? () => cycleStore.fetchCycles(workspaceSlug, projectId, "current") : null
|
workspaceSlug && projectId ? () => cycleStore.fetchCycles(workspaceSlug, projectId, "current") : null
|
||||||
);
|
);
|
||||||
@ -94,7 +94,7 @@ export const ActiveCycleDetails: React.FC<IActiveCycleDetails> = observer((props
|
|||||||
// : null
|
// : null
|
||||||
// ) as { data: IIssue[] | undefined };
|
// ) as { data: IIssue[] | undefined };
|
||||||
|
|
||||||
if (!cycle)
|
if (!cycle && isLoading)
|
||||||
return (
|
return (
|
||||||
<Loader>
|
<Loader>
|
||||||
<Loader.Item height="250px" />
|
<Loader.Item height="250px" />
|
||||||
@ -187,12 +187,12 @@ export const ActiveCycleDetails: React.FC<IActiveCycleDetails> = observer((props
|
|||||||
cycleStatus === "current"
|
cycleStatus === "current"
|
||||||
? "#09A953"
|
? "#09A953"
|
||||||
: cycleStatus === "upcoming"
|
: cycleStatus === "upcoming"
|
||||||
? "#F7AE59"
|
? "#F7AE59"
|
||||||
: cycleStatus === "completed"
|
: cycleStatus === "completed"
|
||||||
? "#3F76FF"
|
? "#3F76FF"
|
||||||
: cycleStatus === "draft"
|
: cycleStatus === "draft"
|
||||||
? "rgb(var(--color-text-200))"
|
? "rgb(var(--color-text-200))"
|
||||||
: ""
|
: ""
|
||||||
}`}
|
}`}
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
@ -207,12 +207,12 @@ export const ActiveCycleDetails: React.FC<IActiveCycleDetails> = observer((props
|
|||||||
cycleStatus === "current"
|
cycleStatus === "current"
|
||||||
? "bg-green-600/5 text-green-600"
|
? "bg-green-600/5 text-green-600"
|
||||||
: cycleStatus === "upcoming"
|
: cycleStatus === "upcoming"
|
||||||
? "bg-orange-300/5 text-orange-300"
|
? "bg-orange-300/5 text-orange-300"
|
||||||
: cycleStatus === "completed"
|
: cycleStatus === "completed"
|
||||||
? "bg-blue-500/5 text-blue-500"
|
? "bg-blue-500/5 text-blue-500"
|
||||||
: cycleStatus === "draft"
|
: cycleStatus === "draft"
|
||||||
? "bg-neutral-400/5 text-neutral-400"
|
? "bg-neutral-400/5 text-neutral-400"
|
||||||
: ""
|
: ""
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{cycleStatus === "current" ? (
|
{cycleStatus === "current" ? (
|
||||||
|
@ -295,6 +295,19 @@ export class CycleStore implements ICycleStore {
|
|||||||
const _response = await this.cycleService.deleteCycle(workspaceSlug, projectId, cycleId);
|
const _response = await this.cycleService.deleteCycle(workspaceSlug, projectId, cycleId);
|
||||||
|
|
||||||
const _currentView = this.cycleView === "active" ? "current" : this.cycleView;
|
const _currentView = this.cycleView === "active" ? "current" : this.cycleView;
|
||||||
|
|
||||||
|
runInAction(() => {
|
||||||
|
["all", "current", "completed", "upcoming", "draft"].forEach((view) => {
|
||||||
|
this.cycles = {
|
||||||
|
...this.cycles,
|
||||||
|
[projectId]: {
|
||||||
|
...this.cycles[projectId],
|
||||||
|
[view]: this.cycles[projectId][view]?.filter((c) => c.id !== cycleId),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
this.fetchCycles(workspaceSlug, projectId, _currentView);
|
this.fetchCycles(workspaceSlug, projectId, _currentView);
|
||||||
|
|
||||||
return _response;
|
return _response;
|
||||||
|
Loading…
Reference in New Issue
Block a user