From 6344f6f5624de7659b3f8dec3b857cf9ddc10bcc Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Fri, 18 Aug 2023 15:12:12 +0530 Subject: [PATCH] chore: set order by to manual on gantt chart (#1886) --- apps/app/contexts/issue-view.context.tsx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/apps/app/contexts/issue-view.context.tsx b/apps/app/contexts/issue-view.context.tsx index dbf1d9a83bc..530dbee4e2f 100644 --- a/apps/app/contexts/issue-view.context.tsx +++ b/apps/app/contexts/issue-view.context.tsx @@ -362,7 +362,13 @@ export const IssueViewContextProvider: React.FC<{ children: React.ReactNode }> = }, }); - if (property === "kanban") { + const additionalProperties = { + groupByProperty: state.groupByProperty, + orderBy: state.orderBy, + }; + + if (property === "kanban" && state.groupByProperty === null) { + additionalProperties.groupByProperty = "state"; dispatch({ type: "SET_GROUP_BY_PROPERTY", payload: { @@ -371,6 +377,7 @@ export const IssueViewContextProvider: React.FC<{ children: React.ReactNode }> = }); } if (property === "calendar") { + additionalProperties.groupByProperty = null; dispatch({ type: "SET_GROUP_BY_PROPERTY", payload: { @@ -378,13 +385,22 @@ export const IssueViewContextProvider: React.FC<{ children: React.ReactNode }> = }, }); } + if (property === "gantt_chart") { + additionalProperties.orderBy = "sort_order"; + dispatch({ + type: "SET_ORDER_BY_PROPERTY", + payload: { + orderBy: "sort_order", + }, + }); + } if (!workspaceSlug || !projectId) return; saveDataToServer(workspaceSlug as string, projectId as string, { ...state, issueView: property, - groupByProperty: "state", + ...additionalProperties, }); }, [workspaceSlug, projectId, state]