chore: module and cycle bug fixes (#3435)

* chore: project active cycle improvement

* chore: cycle and module add existing mutation fix
This commit is contained in:
Anmol Singh Bhatia 2024-01-23 15:57:26 +05:30 committed by GitHub
parent f3ae57bc85
commit c6b756d918
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 26 deletions

View File

@ -250,10 +250,11 @@ export const ActiveCycleDetails: React.FC<IActiveCycleDetails> = observer((props
</div> </div>
</div> </div>
<Link href={`/${workspaceSlug}/projects/${projectId}/cycles/${activeCycle.id}`}> <Link
<span className="w-full rounded-md bg-custom-primary px-4 py-2 text-center text-sm font-medium text-white hover:bg-custom-primary/90"> href={`/${workspaceSlug}/projects/${projectId}/cycles/${activeCycle.id}`}
View Cycle className="w-min text-nowrap rounded-md bg-custom-primary px-4 py-2 text-center text-sm font-medium text-white hover:bg-custom-primary/90"
</span> >
View Cycle
</Link> </Link>
</div> </div>
</div> </div>

View File

@ -104,13 +104,13 @@ export const CYCLE_STATE_GROUPS_DETAILS = [
color: "#FFC53D", color: "#FFC53D",
}, },
{ {
key: "cancelled_issues", key: "completed_issues",
title: "Cancelled", title: "Completed",
color: "#d687ff", color: "#d687ff",
}, },
{ {
key: "completed_issues", key: "cancelled_issues",
title: "Completed", title: "Cancelled",
color: "#ef4444", color: "#ef4444",
}, },
]; ];

View File

@ -182,13 +182,6 @@ export class CycleIssues extends IssueHelperStore implements ICycleIssues {
const response = await this.rootIssueStore.projectIssues.createIssue(workspaceSlug, projectId, data); const response = await this.rootIssueStore.projectIssues.createIssue(workspaceSlug, projectId, data);
await this.addIssueToCycle(workspaceSlug, projectId, cycleId, [response.id]); await this.addIssueToCycle(workspaceSlug, projectId, cycleId, [response.id]);
runInAction(() => {
update(this.issues, cycleId, (cycleIssueIds) => {
if (!cycleIssueIds) return [response.id];
else return concat(cycleIssueIds, [response.id]);
});
});
return response; return response;
} catch (error) { } catch (error) {
throw error; throw error;
@ -272,8 +265,11 @@ export class CycleIssues extends IssueHelperStore implements ICycleIssues {
issues: issueIds, issues: issueIds,
}); });
issueIds.map((issueId) => { runInAction(() => {
this.rootIssueStore.issues.updateIssue(issueId, { cycle_id: cycleId }); update(this.issues, cycleId, (cycleIssueIds) => {
if (!cycleIssueIds) return [...issueIds];
else return concat(cycleIssueIds, [...issueIds]);
});
}); });
return issueToCycle; return issueToCycle;

View File

@ -175,13 +175,6 @@ export class ModuleIssues extends IssueHelperStore implements IModuleIssues {
const response = await this.rootIssueStore.projectIssues.createIssue(workspaceSlug, projectId, data); const response = await this.rootIssueStore.projectIssues.createIssue(workspaceSlug, projectId, data);
await this.addIssueToModule(workspaceSlug, projectId, moduleId, [response.id]); await this.addIssueToModule(workspaceSlug, projectId, moduleId, [response.id]);
runInAction(() => {
update(this.issues, moduleId, (moduleIssueIds) => {
if (!moduleIssueIds) return [response.id];
else return concat(moduleIssueIds, [response.id]);
});
});
return response; return response;
} catch (error) { } catch (error) {
throw error; throw error;
@ -264,8 +257,11 @@ export class ModuleIssues extends IssueHelperStore implements IModuleIssues {
issues: issueIds, issues: issueIds,
}); });
issueIds.map((issueId) => { runInAction(() => {
this.rootIssueStore.issues.updateIssue(issueId, { module_id: moduleId }); update(this.issues, moduleId, (moduleIssueIds) => {
if (!moduleIssueIds) return [...issueIds];
else return concat(moduleIssueIds, [...issueIds]);
});
}); });
return issueToModule; return issueToModule;