fix: cycle delete & active cycle loading (#3088)

This commit is contained in:
Lakhan Baheti 2023-12-13 23:06:38 +05:30 committed by GitHub
parent 6c61fbd102
commit 4bb99d5fbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 14 deletions

View File

@ -75,7 +75,7 @@ export const ActiveCycleDetails: React.FC<IActiveCycleDetails> = observer((props
const { setToastAlert } = useToast();
useSWR(
const { isLoading } = useSWR(
workspaceSlug && projectId ? `ACTIVE_CYCLE_ISSUE_${projectId}_CURRENT` : null,
workspaceSlug && projectId ? () => cycleStore.fetchCycles(workspaceSlug, projectId, "current") : null
);
@ -94,7 +94,7 @@ export const ActiveCycleDetails: React.FC<IActiveCycleDetails> = observer((props
// : null
// ) as { data: IIssue[] | undefined };
if (!cycle)
if (!cycle && isLoading)
return (
<Loader>
<Loader.Item height="250px" />

View File

@ -295,6 +295,19 @@ export class CycleStore implements ICycleStore {
const _response = await this.cycleService.deleteCycle(workspaceSlug, projectId, cycleId);
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);
return _response;