From 2c67aced155d730d68322f385b8356a0315a4eeb Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Wed, 31 Jan 2024 17:09:24 +0530 Subject: [PATCH] fix: cycle and module sidebar mutation fix (#3521) * fix: cycle and module sidebar mutation * fix: cycle and module calendar drag n drop fix --- web/components/cycles/sidebar.tsx | 18 ++++++++++-------- .../calendar/base-calendar-root.tsx | 3 ++- web/store/issue/cycle/issue.store.ts | 5 ++--- web/store/issue/module/issue.store.ts | 1 + web/store/issue/root.store.ts | 6 ++++++ 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/web/components/cycles/sidebar.tsx b/web/components/cycles/sidebar.tsx index 33c2b3c82..52da51b77 100644 --- a/web/components/cycles/sidebar.tsx +++ b/web/components/cycles/sidebar.tsx @@ -587,14 +587,16 @@ export const CycleDetailsSidebar: React.FC = observer((props) => { -
- -
+ {cycleDetails && cycleDetails.distribution && ( +
+ +
+ )} ) : ( "" diff --git a/web/components/issues/issue-layouts/calendar/base-calendar-root.tsx b/web/components/issues/issue-layouts/calendar/base-calendar-root.tsx index 3b3ef887e..7cb53ad39 100644 --- a/web/components/issues/issue-layouts/calendar/base-calendar-root.tsx +++ b/web/components/issues/issue-layouts/calendar/base-calendar-root.tsx @@ -61,7 +61,8 @@ export const BaseCalendarRoot = observer((props: IBaseCalendarRoot) => { projectId?.toString(), issueStore, issueMap, - groupedIssueIds + groupedIssueIds, + viewId ).catch((err) => { setToastAlert({ title: "Error", diff --git a/web/store/issue/cycle/issue.store.ts b/web/store/issue/cycle/issue.store.ts index 1a8343006..286222e4a 100644 --- a/web/store/issue/cycle/issue.store.ts +++ b/web/store/issue/cycle/issue.store.ts @@ -200,6 +200,7 @@ export class CycleIssues extends IssueHelperStore implements ICycleIssues { if (!cycleId) throw new Error("Cycle Id is required"); const response = await this.rootIssueStore.projectIssues.updateIssue(workspaceSlug, projectId, issueId, data); + this.rootIssueStore.rootStore.cycle.fetchCycleDetails(workspaceSlug, projectId, cycleId); return response; } catch (error) { this.fetchIssues(workspaceSlug, projectId, "mutation", cycleId); @@ -267,9 +268,7 @@ export class CycleIssues extends IssueHelperStore implements ICycleIssues { }); runInAction(() => { - update(this.issues, cycleId, (cycleIssueIds = []) => { - return uniq(concat(cycleIssueIds, issueIds)); - }); + update(this.issues, cycleId, (cycleIssueIds = []) => uniq(concat(cycleIssueIds, issueIds))); }); issueIds.forEach((issueId) => { this.rootStore.issues.updateIssue(issueId, { cycle_id: cycleId }); diff --git a/web/store/issue/module/issue.store.ts b/web/store/issue/module/issue.store.ts index da2b127c1..e32b97df0 100644 --- a/web/store/issue/module/issue.store.ts +++ b/web/store/issue/module/issue.store.ts @@ -205,6 +205,7 @@ export class ModuleIssues extends IssueHelperStore implements IModuleIssues { if (!moduleId) throw new Error("Module Id is required"); const response = await this.rootIssueStore.projectIssues.updateIssue(workspaceSlug, projectId, issueId, data); + this.rootIssueStore.rootStore.module.fetchModuleDetails(workspaceSlug, projectId, moduleId); return response; } catch (error) { this.fetchIssues(workspaceSlug, projectId, "mutation", moduleId); diff --git a/web/store/issue/root.store.ts b/web/store/issue/root.store.ts index 04f46c280..b2425757c 100644 --- a/web/store/issue/root.store.ts +++ b/web/store/issue/root.store.ts @@ -38,6 +38,8 @@ export interface IIssueRootStore { members: string[] | undefined; projects: string[] | undefined; + rootStore: RootStore; + issues: IIssueStore; state: IStateStore; @@ -87,6 +89,8 @@ export class IssueRootStore implements IIssueRootStore { members: string[] | undefined = undefined; projects: string[] | undefined = undefined; + rootStore: RootStore; + issues: IIssueStore; state: IStateStore; @@ -136,6 +140,8 @@ export class IssueRootStore implements IIssueRootStore { projects: observable, }); + this.rootStore = rootStore; + autorun(() => { if (rootStore.user.currentUser?.id) this.currentUserId = rootStore.user.currentUser?.id; if (rootStore.app.router.workspaceSlug) this.workspaceSlug = rootStore.app.router.workspaceSlug;