fix: cycle and module sidebar mutation fix (#3521)

* fix: cycle and module sidebar mutation

* fix: cycle and module calendar drag n drop fix
This commit is contained in:
Anmol Singh Bhatia 2024-01-31 17:09:24 +05:30 committed by GitHub
parent 3a4c893368
commit 2c67aced15
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 21 additions and 12 deletions

View File

@ -587,14 +587,16 @@ export const CycleDetailsSidebar: React.FC<Props> = observer((props) => {
</div> </div>
</div> </div>
</div> </div>
<div className="relative h-40 w-80"> {cycleDetails && cycleDetails.distribution && (
<ProgressChart <div className="relative h-40 w-80">
distribution={cycleDetails.distribution?.completion_chart ?? {}} <ProgressChart
startDate={cycleDetails.start_date ?? ""} distribution={cycleDetails.distribution?.completion_chart ?? {}}
endDate={cycleDetails.end_date ?? ""} startDate={cycleDetails.start_date ?? ""}
totalIssues={cycleDetails.total_issues} endDate={cycleDetails.end_date ?? ""}
/> totalIssues={cycleDetails.total_issues}
</div> />
</div>
)}
</div> </div>
) : ( ) : (
"" ""

View File

@ -61,7 +61,8 @@ export const BaseCalendarRoot = observer((props: IBaseCalendarRoot) => {
projectId?.toString(), projectId?.toString(),
issueStore, issueStore,
issueMap, issueMap,
groupedIssueIds groupedIssueIds,
viewId
).catch((err) => { ).catch((err) => {
setToastAlert({ setToastAlert({
title: "Error", title: "Error",

View File

@ -200,6 +200,7 @@ export class CycleIssues extends IssueHelperStore implements ICycleIssues {
if (!cycleId) throw new Error("Cycle Id is required"); if (!cycleId) throw new Error("Cycle Id is required");
const response = await this.rootIssueStore.projectIssues.updateIssue(workspaceSlug, projectId, issueId, data); const response = await this.rootIssueStore.projectIssues.updateIssue(workspaceSlug, projectId, issueId, data);
this.rootIssueStore.rootStore.cycle.fetchCycleDetails(workspaceSlug, projectId, cycleId);
return response; return response;
} catch (error) { } catch (error) {
this.fetchIssues(workspaceSlug, projectId, "mutation", cycleId); this.fetchIssues(workspaceSlug, projectId, "mutation", cycleId);
@ -267,9 +268,7 @@ export class CycleIssues extends IssueHelperStore implements ICycleIssues {
}); });
runInAction(() => { runInAction(() => {
update(this.issues, cycleId, (cycleIssueIds = []) => { update(this.issues, cycleId, (cycleIssueIds = []) => uniq(concat(cycleIssueIds, issueIds)));
return uniq(concat(cycleIssueIds, issueIds));
});
}); });
issueIds.forEach((issueId) => { issueIds.forEach((issueId) => {
this.rootStore.issues.updateIssue(issueId, { cycle_id: cycleId }); this.rootStore.issues.updateIssue(issueId, { cycle_id: cycleId });

View File

@ -205,6 +205,7 @@ export class ModuleIssues extends IssueHelperStore implements IModuleIssues {
if (!moduleId) throw new Error("Module Id is required"); if (!moduleId) throw new Error("Module Id is required");
const response = await this.rootIssueStore.projectIssues.updateIssue(workspaceSlug, projectId, issueId, data); const response = await this.rootIssueStore.projectIssues.updateIssue(workspaceSlug, projectId, issueId, data);
this.rootIssueStore.rootStore.module.fetchModuleDetails(workspaceSlug, projectId, moduleId);
return response; return response;
} catch (error) { } catch (error) {
this.fetchIssues(workspaceSlug, projectId, "mutation", moduleId); this.fetchIssues(workspaceSlug, projectId, "mutation", moduleId);

View File

@ -38,6 +38,8 @@ export interface IIssueRootStore {
members: string[] | undefined; members: string[] | undefined;
projects: string[] | undefined; projects: string[] | undefined;
rootStore: RootStore;
issues: IIssueStore; issues: IIssueStore;
state: IStateStore; state: IStateStore;
@ -87,6 +89,8 @@ export class IssueRootStore implements IIssueRootStore {
members: string[] | undefined = undefined; members: string[] | undefined = undefined;
projects: string[] | undefined = undefined; projects: string[] | undefined = undefined;
rootStore: RootStore;
issues: IIssueStore; issues: IIssueStore;
state: IStateStore; state: IStateStore;
@ -136,6 +140,8 @@ export class IssueRootStore implements IIssueRootStore {
projects: observable, projects: observable,
}); });
this.rootStore = rootStore;
autorun(() => { autorun(() => {
if (rootStore.user.currentUser?.id) this.currentUserId = rootStore.user.currentUser?.id; if (rootStore.user.currentUser?.id) this.currentUserId = rootStore.user.currentUser?.id;
if (rootStore.app.router.workspaceSlug) this.workspaceSlug = rootStore.app.router.workspaceSlug; if (rootStore.app.router.workspaceSlug) this.workspaceSlug = rootStore.app.router.workspaceSlug;