Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.

Commit 699935e

Browse files
prateekshourya29nishantPFM
authored andcommitted
improvement: refactored issue grouping logic to access MobX store directly (makeplane#6134)
* improvement: refactored issue grouping logic to access MobX store directly * chore: minor updates
1 parent 30d1760 commit 699935e

File tree

7 files changed

+170
-273
lines changed

7 files changed

+170
-273
lines changed

packages/types/src/issues.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ export type GroupByColumnTypes =
216216
export interface IGroupByColumn {
217217
id: string;
218218
name: string;
219-
icon: ReactElement | undefined;
219+
icon?: ReactElement | undefined;
220220
payload: Partial<TIssue>;
221221
isDropDisabled?: boolean;
222222
dropErrorMessage?: string;

web/core/components/issues/issue-layouts/kanban/default.tsx

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { ContentWrapper } from "@plane/ui";
1818
import RenderIfVisible from "@/components/core/render-if-visible-HOC";
1919
import { KanbanColumnLoader } from "@/components/ui";
2020
// hooks
21-
import { useCycle, useKanbanView, useLabel, useMember, useModule, useProject, useProjectState } from "@/hooks/store";
21+
import { useKanbanView } from "@/hooks/store";
2222
import { useIssueStoreType } from "@/hooks/use-issue-layout-store";
2323
// types
2424
// parent components
@@ -87,30 +87,16 @@ export const KanBan: React.FC<IKanBan> = observer((props) => {
8787
dropErrorMessage,
8888
subGroupIndex = 0,
8989
} = props;
90-
90+
// store hooks
9191
const storeType = useIssueStoreType();
92-
93-
const member = useMember();
94-
const project = useProject();
95-
const label = useLabel();
96-
const cycle = useCycle();
97-
const moduleInfo = useModule();
98-
const projectState = useProjectState();
9992
const issueKanBanView = useKanbanView();
100-
93+
// derived values
10194
const isDragDisabled = !issueKanBanView?.getCanUserDragDrop(group_by, sub_group_by);
102-
103-
const list = getGroupByColumns(
104-
group_by as GroupByColumnTypes,
105-
project,
106-
cycle,
107-
moduleInfo,
108-
label,
109-
projectState,
110-
member,
111-
true,
112-
isWorkspaceLevel(storeType)
113-
);
95+
const list = getGroupByColumns({
96+
groupBy: group_by as GroupByColumnTypes,
97+
includeNone: true,
98+
isWorkspaceLevel: isWorkspaceLevel(storeType),
99+
});
114100

115101
if (!list) return null;
116102

web/core/components/issues/issue-layouts/kanban/swimlanes.tsx

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
// UI
1616
import { Row } from "@plane/ui";
1717
// hooks
18-
import { useCycle, useLabel, useMember, useModule, useProject, useProjectState } from "@/hooks/store";
1918
import { useIssueStoreType } from "@/hooks/use-issue-layout-store";
2019
// components
2120
import { TRenderQuickActions } from "../list/list-view-types";
@@ -262,38 +261,19 @@ export const KanBanSwimLanes: React.FC<IKanBanSwimLanes> = observer((props) => {
262261
quickAddCallback,
263262
scrollableContainerRef,
264263
} = props;
265-
264+
// store hooks
266265
const storeType = useIssueStoreType();
267-
268-
const member = useMember();
269-
const project = useProject();
270-
const label = useLabel();
271-
const cycle = useCycle();
272-
const projectModule = useModule();
273-
const projectState = useProjectState();
274-
275-
const groupByList = getGroupByColumns(
276-
group_by as GroupByColumnTypes,
277-
project,
278-
cycle,
279-
projectModule,
280-
label,
281-
projectState,
282-
member,
283-
true,
284-
isWorkspaceLevel(storeType)
285-
);
286-
const subGroupByList = getGroupByColumns(
287-
sub_group_by as GroupByColumnTypes,
288-
project,
289-
cycle,
290-
projectModule,
291-
label,
292-
projectState,
293-
member,
294-
true,
295-
isWorkspaceLevel(storeType)
296-
);
266+
// derived values
267+
const groupByList = getGroupByColumns({
268+
groupBy: group_by as GroupByColumnTypes,
269+
includeNone: true,
270+
isWorkspaceLevel: isWorkspaceLevel(storeType),
271+
});
272+
const subGroupByList = getGroupByColumns({
273+
groupBy: sub_group_by as GroupByColumnTypes,
274+
includeNone: true,
275+
isWorkspaceLevel: isWorkspaceLevel(storeType),
276+
});
297277

298278
if (!groupByList || !subGroupByList) return null;
299279

web/core/components/issues/issue-layouts/list/default.tsx

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ import {
1818
} from "@plane/types";
1919
// components
2020
import { MultipleSelectGroup } from "@/components/core";
21-
2221
// hooks
23-
import { useCycle, useLabel, useMember, useModule, useProject, useProjectState } from "@/hooks/store";
2422
import { useIssueStoreType } from "@/hooks/use-issue-layout-store";
2523
// plane web components
2624
import { IssueBulkOperationsRoot } from "@/plane-web/components/issues";
@@ -75,29 +73,16 @@ export const List: React.FC<IList> = observer((props) => {
7573
} = props;
7674

7775
const storeType = useIssueStoreType();
78-
// store hooks
79-
const member = useMember();
80-
const project = useProject();
81-
const label = useLabel();
82-
const projectState = useProjectState();
83-
const cycle = useCycle();
84-
const projectModule = useModule();
8576
// plane web hooks
8677
const isBulkOperationsEnabled = useBulkOperationStatus();
8778

8879
const containerRef = useRef<HTMLDivElement | null>(null);
8980

90-
const groups = getGroupByColumns(
91-
group_by as GroupByColumnTypes,
92-
project,
93-
cycle,
94-
projectModule,
95-
label,
96-
projectState,
97-
member,
98-
true,
99-
isWorkspaceLevel(storeType)
100-
);
81+
const groups = getGroupByColumns({
82+
groupBy: group_by as GroupByColumnTypes,
83+
includeNone: true,
84+
isWorkspaceLevel: isWorkspaceLevel(storeType),
85+
});
10186

10287
// Enable Auto Scroll for Main Kanban
10388
useEffect(() => {

0 commit comments

Comments
 (0)