From a9ffd18a2f6dc2da58bba77b1a191b5640b86fab Mon Sep 17 00:00:00 2001 From: rahulramesha Date: Tue, 26 Mar 2024 12:27:43 +0530 Subject: [PATCH 1/7] fix orderby priority for spreadsheet --- web/constants/spreadsheet.ts | 4 ++-- web/store/issue/helpers/base-issues.store.ts | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/web/constants/spreadsheet.ts b/web/constants/spreadsheet.ts index 50d6c15df..b498b4e7d 100644 --- a/web/constants/spreadsheet.ts +++ b/web/constants/spreadsheet.ts @@ -101,9 +101,9 @@ export const SPREADSHEET_PROPERTY_DETAILS: { }, priority: { title: "Priority", - ascendingOrderKey: "priority", + ascendingOrderKey: "-priority", ascendingOrderTitle: "None", - descendingOrderKey: "-priority", + descendingOrderKey: "priority", descendingOrderTitle: "Urgent", icon: Signal, Column: SpreadsheetPriorityColumn, diff --git a/web/store/issue/helpers/base-issues.store.ts b/web/store/issue/helpers/base-issues.store.ts index 2b1812a23..f8b75a8f6 100644 --- a/web/store/issue/helpers/base-issues.store.ts +++ b/web/store/issue/helpers/base-issues.store.ts @@ -783,7 +783,7 @@ export class BaseIssuesStore implements IBaseIssuesStore { issuesSortWithOrderBy = (issueIds: string[], key: TIssueOrderByOptions | undefined): string[] => { const issues = this.rootIssueStore.issues.getIssuesByIds(issueIds, this.isArchived ? "archived" : "un-archived"); - const array = orderBy(issues, "created_at", ["asc"]); + const array = orderBy(issues, "created_at", ["desc"]); switch (key) { case "sort_order": @@ -834,13 +834,13 @@ export class BaseIssuesStore implements IBaseIssuesStore { // custom case "priority": { const sortArray = ISSUE_PRIORITIES.map((i) => i.key); - return this.getIssueIds( - orderBy(array, (currentIssue: TIssue) => indexOf(sortArray, currentIssue.priority), ["desc"]) - ); + return this.getIssueIds(orderBy(array, (currentIssue: TIssue) => indexOf(sortArray, currentIssue.priority))); } case "-priority": { const sortArray = ISSUE_PRIORITIES.map((i) => i.key); - return this.getIssueIds(orderBy(array, (currentIssue: TIssue) => indexOf(sortArray, currentIssue.priority))); + return this.getIssueIds( + orderBy(array, (currentIssue: TIssue) => indexOf(sortArray, currentIssue.priority), ["desc"]) + ); } // number From 26e8cd139946bf96b6098639edfc13096b10cb86 Mon Sep 17 00:00:00 2001 From: rahulramesha Date: Tue, 26 Mar 2024 12:28:11 +0530 Subject: [PATCH 2/7] fix subGroupCount --- web/store/issue/helpers/base-issues.store.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/store/issue/helpers/base-issues.store.ts b/web/store/issue/helpers/base-issues.store.ts index f8b75a8f6..135870d5d 100644 --- a/web/store/issue/helpers/base-issues.store.ts +++ b/web/store/issue/helpers/base-issues.store.ts @@ -1099,6 +1099,8 @@ export class BaseIssuesStore implements IBaseIssuesStore { for (const groupKey of groupIssuesKeys) { if (groupKey.includes(subGroupId)) subGroupCumulativeCount += this.groupedIssueCount[groupKey]; } + + return subGroupCumulativeCount; } return get(this.groupedIssueCount, [this.getGroupKey(groupId, subGroupId)]); From eea1cce9264dc8a2e95aab68fe527afb2207dc2b Mon Sep 17 00:00:00 2001 From: rahulramesha Date: Tue, 26 Mar 2024 12:28:28 +0530 Subject: [PATCH 3/7] Fix logic for load more in Kanban --- .../issue-layouts/kanban/kanban-group.tsx | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/web/components/issues/issue-layouts/kanban/kanban-group.tsx b/web/components/issues/issue-layouts/kanban/kanban-group.tsx index 30f7ce75f..0713ede4e 100644 --- a/web/components/issues/issue-layouts/kanban/kanban-group.tsx +++ b/web/components/issues/issue-layouts/kanban/kanban-group.tsx @@ -179,17 +179,18 @@ export const KanbanGroup = observer((props: IKanbanGroup) => { {provided.placeholder} - {shouldLoadMore && isSubGroup ? ( -
loadMoreIssues(groupId, sub_group_id)} - > - {" "} - Load more ↓ -
- ) : ( - - )} + {shouldLoadMore && + (isSubGroup ? ( +
loadMoreIssues(groupId, sub_group_id)} + > + {" "} + Load more ↓ +
+ ) : ( + + ))} {enableQuickIssueCreate && !disableIssueCreation && (
From 295fdc9386dc2fd7e210446b1d907337eac9ef76 Mon Sep 17 00:00:00 2001 From: rahulramesha Date: Tue, 26 Mar 2024 13:08:48 +0530 Subject: [PATCH 4/7] fix issue quick add --- web/store/issue/helpers/base-issues.store.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/web/store/issue/helpers/base-issues.store.ts b/web/store/issue/helpers/base-issues.store.ts index 135870d5d..4f0b3f7ef 100644 --- a/web/store/issue/helpers/base-issues.store.ts +++ b/web/store/issue/helpers/base-issues.store.ts @@ -39,9 +39,9 @@ import isEqual from "date-fns/isEqual"; export type TIssueDisplayFilterOptions = Exclude | "target_date"; export enum EIssueGroupedAction { - ADD, - DELETE, - REORDER, + ADD = "ADD", + DELETE = "DELETE", + REORDER = "REORDER", } export const ALL_ISSUES = "All Issues"; @@ -154,9 +154,14 @@ export class BaseIssuesStore implements IBaseIssuesStore { onfetchNexIssues: action.bound, clear: action.bound, getPaginationData: action.bound, + addIssue: action.bound, + removeIssueFromList: action.bound, createIssue: action, updateIssue: action, + createDraftIssue: action, + updateDraftIssue: action, + issueQuickAdd: action.bound, removeIssue: action, archiveIssue: action, removeBulkIssues: action, @@ -661,7 +666,8 @@ export class BaseIssuesStore implements IBaseIssuesStore { getDifference = ( current: string[], - previous: string[] + previous: string[], + action?: EIssueGroupedAction.ADD | EIssueGroupedAction.DELETE ): { [EIssueGroupedAction.ADD]: string[]; [EIssueGroupedAction.DELETE]: string[] } => { const ADD = []; const DELETE = []; @@ -675,7 +681,11 @@ export class BaseIssuesStore implements IBaseIssuesStore { DELETE.push(previousValue); } - return { [EIssueGroupedAction.ADD]: ADD, [EIssueGroupedAction.DELETE]: DELETE }; + if (!action) return { [EIssueGroupedAction.ADD]: ADD, [EIssueGroupedAction.DELETE]: DELETE }; + + if (action === EIssueGroupedAction.ADD) + return { [EIssueGroupedAction.ADD]: [...ADD, ...DELETE], [EIssueGroupedAction.DELETE]: [] }; + else return { [EIssueGroupedAction.DELETE]: [...ADD, ...DELETE], [EIssueGroupedAction.ADD]: [] }; }; issueDisplayFiltersDefaultData = (groupBy: string | null): string[] => { From 834bf27231b00720bf74068e43d4b31b926848ed Mon Sep 17 00:00:00 2001 From: rahulramesha Date: Tue, 26 Mar 2024 14:09:43 +0530 Subject: [PATCH 5/7] fix order by for modules and cycles --- packages/types/src/view-props.d.ts | 8 ++++---- web/constants/spreadsheet.ts | 8 ++++---- web/store/issue/helpers/base-issues.store.ts | 16 ++++++++-------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/types/src/view-props.d.ts b/packages/types/src/view-props.d.ts index f151aac00..4a5746c0c 100644 --- a/packages/types/src/view-props.d.ts +++ b/packages/types/src/view-props.d.ts @@ -27,10 +27,10 @@ export type TIssueOrderByOptions = | "-assignees__first_name" | "labels__name" | "-labels__name" - | "modules__name" - | "-modules__name" - | "cycle__name" - | "-cycle__name" + | "issue_module__module__name" + | "-issue_module__module__name" + | "issue_cycle__cycle__name" + | "-issue_cycle__cycle__name" | "target_date" | "-target_date" | "estimate_point" diff --git a/web/constants/spreadsheet.ts b/web/constants/spreadsheet.ts index b498b4e7d..ea84acf15 100644 --- a/web/constants/spreadsheet.ts +++ b/web/constants/spreadsheet.ts @@ -83,18 +83,18 @@ export const SPREADSHEET_PROPERTY_DETAILS: { }, modules: { title: "Modules", - ascendingOrderKey: "modules__name", + ascendingOrderKey: "issue_module__module__name", ascendingOrderTitle: "A", - descendingOrderKey: "-modules__name", + descendingOrderKey: "-issue_module__module__name", descendingOrderTitle: "Z", icon: DiceIcon, Column: SpreadsheetModuleColumn, }, cycle: { title: "Cycle", - ascendingOrderKey: "cycle__name", + ascendingOrderKey: "issue_cycle__cycle__name", ascendingOrderTitle: "A", - descendingOrderKey: "-cycle__name", + descendingOrderKey: "-issue_cycle__cycle__name", descendingOrderTitle: "Z", icon: ContrastIcon, Column: SpreadsheetCycleColumn, diff --git a/web/store/issue/helpers/base-issues.store.ts b/web/store/issue/helpers/base-issues.store.ts index 4f0b3f7ef..a0cfe3a1b 100644 --- a/web/store/issue/helpers/base-issues.store.ts +++ b/web/store/issue/helpers/base-issues.store.ts @@ -95,10 +95,10 @@ const ISSUE_ORDERBY_KEY: Record = { "-assignees__first_name": "assignee_ids", labels__name: "label_ids", "-labels__name": "label_ids", - modules__name: "module_ids", - "-modules__name": "module_ids", - cycle__name: "cycle_id", - "-cycle__name": "cycle_id", + issue_module__module__name: "module_ids", + "-issue_module__module__name": "module_ids", + issue_cycle__cycle__name: "cycle_id", + "-issue_cycle__cycle__name": "cycle_id", target_date: "target_date", "-target_date": "target_date", estimate_point: "estimate_point", @@ -902,14 +902,14 @@ export class BaseIssuesStore implements IBaseIssuesStore { ) ); - case "modules__name": + case "issue_module__module__name": return this.getIssueIds( orderBy(array, [ this.getSortOrderToFilterEmptyValues.bind(null, "module_ids"), //preferring sorting based on empty values to always keep the empty values below (issue) => this.populateIssueDataForSorting("module_ids", issue["module_ids"], "asc"), ]) ); - case "-modules__name": + case "-issue_module__module__name": return this.getIssueIds( orderBy( array, @@ -921,14 +921,14 @@ export class BaseIssuesStore implements IBaseIssuesStore { ) ); - case "cycle__name": + case "issue_cycle__cycle__name": return this.getIssueIds( orderBy(array, [ this.getSortOrderToFilterEmptyValues.bind(null, "cycle_id"), //preferring sorting based on empty values to always keep the empty values below (issue) => this.populateIssueDataForSorting("cycle_id", issue["cycle_id"], "asc"), ]) ); - case "-cycle__name": + case "-issue_cycle__cycle__name": return this.getIssueIds( orderBy( array, From 236f0c544a0ba1edc09cda8613f35c4c497905b4 Mon Sep 17 00:00:00 2001 From: rahulramesha Date: Tue, 26 Mar 2024 16:52:00 +0530 Subject: [PATCH 6/7] fix non render of Issues --- web/components/core/render-if-visible-HOC.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/components/core/render-if-visible-HOC.tsx b/web/components/core/render-if-visible-HOC.tsx index f0e9f59b4..ae8586615 100644 --- a/web/components/core/render-if-visible-HOC.tsx +++ b/web/components/core/render-if-visible-HOC.tsx @@ -24,7 +24,7 @@ const RenderIfVisible: React.FC = (props) => { as = "div", children, classNames = "", - alwaysRender = false, //render the children even if it is not visble in root + alwaysRender = false, //render the children even if it is not visible in root placeholderChildren = null, //placeholder children pauseHeightUpdateWhileRendering = false, //while this is true the height of the blocks are maintained changingReference, //This is to force render when this reference is changed @@ -48,7 +48,7 @@ const RenderIfVisible: React.FC = (props) => { // } else { // setShouldVisible(entries[0].isIntersecting); // } - setShouldVisible(entries[0].isIntersecting); + setShouldVisible(entries[entries.length - 1].isIntersecting); }, { root: root?.current, @@ -63,7 +63,7 @@ const RenderIfVisible: React.FC = (props) => { } }; } - }, [intersectionRef, children, changingReference, root, verticalOffset, horizontalOffset]); + }, [intersectionRef, children, root, verticalOffset, horizontalOffset]); //Set height after render useEffect(() => { From 0af1f9e1f0762034bff5f6729b334e528a7125c2 Mon Sep 17 00:00:00 2001 From: rahulramesha Date: Tue, 26 Mar 2024 16:52:55 +0530 Subject: [PATCH 7/7] fix subGroupKey generation when subGroupId is null --- web/store/issue/helpers/base-issues.store.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/store/issue/helpers/base-issues.store.ts b/web/store/issue/helpers/base-issues.store.ts index a0cfe3a1b..7bd607d28 100644 --- a/web/store/issue/helpers/base-issues.store.ts +++ b/web/store/issue/helpers/base-issues.store.ts @@ -1083,7 +1083,7 @@ export class BaseIssuesStore implements IBaseIssuesStore { } getGroupKey(groupId?: string, subGroupId?: string) { - if (groupId && subGroupId) return `${groupId}_${subGroupId}`; + if (groupId && subGroupId && subGroupId !== "null") return `${groupId}_${subGroupId}`; if (groupId) return groupId;