From d22c258c00c941872e37cf02e48941c3c7c91a8c Mon Sep 17 00:00:00 2001 From: rahulramesha <71900764+rahulramesha@users.noreply.github.com> Date: Fri, 1 Dec 2023 18:51:52 +0530 Subject: [PATCH] fix: V3 release blocker bugs (#2968) * fix add subgroup issue FED-1101 * fix subgroup by None assignee FED-1100 * fix grouping by asignee or labels FED-1096 * fix create view popup FED-1093 * fix subgroup exception in swimlanes --- web/components/issues/form.tsx | 3 ++- .../issue-layouts/kanban/base-kanban-root.tsx | 1 + .../issues/issue-layouts/kanban/swimlanes.tsx | 23 +++++++++++++++++++ web/components/views/modal.tsx | 7 +++++- web/store/command-palette.store.ts | 20 ++++++++-------- .../issues/project-issues/base-issue.store.ts | 11 +++++---- 6 files changed, 49 insertions(+), 16 deletions(-) diff --git a/web/components/issues/form.tsx b/web/components/issues/form.tsx index e58bed089..643b60460 100644 --- a/web/components/issues/form.tsx +++ b/web/components/issues/form.tsx @@ -226,9 +226,10 @@ export const IssueForm: FC = observer((props) => { reset({ ...defaultValues, + project: projectId, ...initialData, }); - }, [setFocus, reset]); + }, [setFocus, initialData, reset]); // update projectId in form when projectId changes useEffect(() => { diff --git a/web/components/issues/issue-layouts/kanban/base-kanban-root.tsx b/web/components/issues/issue-layouts/kanban/base-kanban-root.tsx index aa3ba503e..e63b6e745 100644 --- a/web/components/issues/issue-layouts/kanban/base-kanban-root.tsx +++ b/web/components/issues/issue-layouts/kanban/base-kanban-root.tsx @@ -267,6 +267,7 @@ export const BaseKanBanRoot: React.FC = observer((props: IBas enableQuickIssueCreate={enableQuickAdd} isReadOnly={!enableInlineEditing || !isEditingAllowed} currentStore={currentStore} + quickAddCallback={issueStore?.quickAddIssue} addIssuesToView={(issues) => { console.log("kanban existingIds", issues); diff --git a/web/components/issues/issue-layouts/kanban/swimlanes.tsx b/web/components/issues/issue-layouts/kanban/swimlanes.tsx index e599a9e59..1c6d23162 100644 --- a/web/components/issues/issue-layouts/kanban/swimlanes.tsx +++ b/web/components/issues/issue-layouts/kanban/swimlanes.tsx @@ -91,6 +91,12 @@ interface ISubGroupSwimlane extends ISubGroupSwimlaneHeader { currentStore?: EProjectStore; enableQuickIssueCreate: boolean; isReadOnly: boolean; + quickAddCallback?: ( + workspaceSlug: string, + projectId: string, + data: IIssue, + viewId?: string + ) => Promise; } const SubGroupSwimlane: React.FC = observer((props) => { const { @@ -118,6 +124,7 @@ const SubGroupSwimlane: React.FC = observer((props) => { enableQuickIssueCreate, isReadOnly, addIssuesToView, + quickAddCallback, } = props; const calculateIssueCount = (column_id: string) => { @@ -176,6 +183,7 @@ const SubGroupSwimlane: React.FC = observer((props) => { isDragStarted={isDragStarted} isReadOnly={isReadOnly} addIssuesToView={addIssuesToView} + quickAddCallback={quickAddCallback} /> )} @@ -208,6 +216,12 @@ export interface IKanBanSwimLanes { currentStore?: EProjectStore; addIssuesToView?: (issueIds: string[]) => Promise; enableQuickIssueCreate: boolean; + quickAddCallback?: ( + workspaceSlug: string, + projectId: string, + data: IIssue, + viewId?: string + ) => Promise; isReadOnly: boolean; } @@ -236,6 +250,7 @@ export const KanBanSwimLanes: React.FC = observer((props) => { isReadOnly, currentStore, addIssuesToView, + quickAddCallback, } = props; return ( @@ -378,6 +393,7 @@ export const KanBanSwimLanes: React.FC = observer((props) => { disableIssueCreation={disableIssueCreation} enableQuickIssueCreate={enableQuickIssueCreate} isReadOnly={isReadOnly} + quickAddCallback={quickAddCallback} /> )} @@ -406,6 +422,7 @@ export const KanBanSwimLanes: React.FC = observer((props) => { disableIssueCreation={disableIssueCreation} enableQuickIssueCreate={enableQuickIssueCreate} isReadOnly={isReadOnly} + quickAddCallback={quickAddCallback} /> )} @@ -434,6 +451,7 @@ export const KanBanSwimLanes: React.FC = observer((props) => { disableIssueCreation={disableIssueCreation} enableQuickIssueCreate={enableQuickIssueCreate} isReadOnly={isReadOnly} + quickAddCallback={quickAddCallback} /> )} @@ -462,6 +480,7 @@ export const KanBanSwimLanes: React.FC = observer((props) => { disableIssueCreation={disableIssueCreation} enableQuickIssueCreate={enableQuickIssueCreate} isReadOnly={isReadOnly} + quickAddCallback={quickAddCallback} /> )} @@ -490,6 +509,7 @@ export const KanBanSwimLanes: React.FC = observer((props) => { disableIssueCreation={disableIssueCreation} enableQuickIssueCreate={enableQuickIssueCreate} isReadOnly={isReadOnly} + quickAddCallback={quickAddCallback} /> )} @@ -518,6 +538,7 @@ export const KanBanSwimLanes: React.FC = observer((props) => { disableIssueCreation={disableIssueCreation} enableQuickIssueCreate={enableQuickIssueCreate} isReadOnly={isReadOnly} + quickAddCallback={quickAddCallback} /> )} @@ -546,6 +567,7 @@ export const KanBanSwimLanes: React.FC = observer((props) => { disableIssueCreation={disableIssueCreation} enableQuickIssueCreate={enableQuickIssueCreate} isReadOnly={isReadOnly} + quickAddCallback={quickAddCallback} /> )} @@ -574,6 +596,7 @@ export const KanBanSwimLanes: React.FC = observer((props) => { disableIssueCreation={disableIssueCreation} enableQuickIssueCreate={enableQuickIssueCreate} isReadOnly={isReadOnly} + quickAddCallback={quickAddCallback} /> )} diff --git a/web/components/views/modal.tsx b/web/components/views/modal.tsx index 8cc1a5981..0d1d6802d 100644 --- a/web/components/views/modal.tsx +++ b/web/components/views/modal.tsx @@ -8,6 +8,7 @@ import useToast from "hooks/use-toast"; import { ProjectViewForm } from "components/views"; // types import { IProjectView } from "types"; +import { debounce } from "lodash"; type Props = { data?: IProjectView | null; @@ -33,7 +34,9 @@ export const CreateUpdateProjectViewModal: FC = observer((props) => { await projectViewsStore .createView(workspaceSlug, projectId, payload) .then(() => { + console.log("after calling store"); handleClose(); + console.log("after closing"); setToastAlert({ type: "success", title: "Success!", @@ -67,6 +70,8 @@ export const CreateUpdateProjectViewModal: FC = observer((props) => { else await updateView(formData); }; + const debouncedFormSubmit = debounce(handleFormSubmit, 10, { leading: false, trailing: true }); + return ( @@ -97,7 +102,7 @@ export const CreateUpdateProjectViewModal: FC = observer((props) => { Promise} preLoadedData={preLoadedData} /> diff --git a/web/store/command-palette.store.ts b/web/store/command-palette.store.ts index b2dac49c5..b2a1be116 100644 --- a/web/store/command-palette.store.ts +++ b/web/store/command-palette.store.ts @@ -115,7 +115,7 @@ class CommandPaletteStore implements ICommandPaletteStore { } toggleCommandPaletteModal = (value?: boolean) => { - if (value) { + if (value !== undefined) { this.isCommandPaletteOpen = value; } else { this.isCommandPaletteOpen = !this.isCommandPaletteOpen; @@ -123,7 +123,7 @@ class CommandPaletteStore implements ICommandPaletteStore { }; toggleShortcutModal = (value?: boolean) => { - if (value) { + if (value !== undefined) { this.isShortcutModalOpen = value; } else { this.isShortcutModalOpen = !this.isShortcutModalOpen; @@ -131,7 +131,7 @@ class CommandPaletteStore implements ICommandPaletteStore { }; toggleCreateProjectModal = (value?: boolean) => { - if (value) { + if (value !== undefined) { this.isCreateProjectModalOpen = value; } else { this.isCreateProjectModalOpen = !this.isCreateProjectModalOpen; @@ -139,7 +139,7 @@ class CommandPaletteStore implements ICommandPaletteStore { }; toggleCreateCycleModal = (value?: boolean) => { - if (value) { + if (value !== undefined) { this.isCreateCycleModalOpen = value; } else { this.isCreateCycleModalOpen = !this.isCreateCycleModalOpen; @@ -147,7 +147,7 @@ class CommandPaletteStore implements ICommandPaletteStore { }; toggleCreateViewModal = (value?: boolean) => { - if (value) { + if (value !== undefined) { this.isCreateViewModalOpen = value; } else { this.isCreateViewModalOpen = !this.isCreateViewModalOpen; @@ -155,7 +155,7 @@ class CommandPaletteStore implements ICommandPaletteStore { }; toggleCreatePageModal = (value?: boolean) => { - if (value) { + if (value !== undefined) { this.isCreatePageModalOpen = value; } else { this.isCreatePageModalOpen = !this.isCreatePageModalOpen; @@ -163,7 +163,7 @@ class CommandPaletteStore implements ICommandPaletteStore { }; toggleCreateIssueModal = (value?: boolean, storeType?: EProjectStore) => { - if (value) { + if (value !== undefined) { this.isCreateIssueModalOpen = value; this.createIssueStoreType = storeType || EProjectStore.PROJECT; } else { @@ -173,7 +173,7 @@ class CommandPaletteStore implements ICommandPaletteStore { }; toggleDeleteIssueModal = (value?: boolean) => { - if (value) { + if (value !== undefined) { this.isDeleteIssueModalOpen = value; } else { this.isDeleteIssueModalOpen = !this.isDeleteIssueModalOpen; @@ -181,7 +181,7 @@ class CommandPaletteStore implements ICommandPaletteStore { }; toggleCreateModuleModal = (value?: boolean) => { - if (value) { + if (value !== undefined) { this.isCreateModuleModalOpen = value; } else { this.isCreateModuleModalOpen = !this.isCreateModuleModalOpen; @@ -189,7 +189,7 @@ class CommandPaletteStore implements ICommandPaletteStore { }; toggleBulkDeleteIssueModal = (value?: boolean) => { - if (value) { + if (value !== undefined) { this.isBulkDeleteIssueModalOpen = value; } else { this.isBulkDeleteIssueModalOpen = !this.isBulkDeleteIssueModalOpen; diff --git a/web/store/issues/project-issues/base-issue.store.ts b/web/store/issues/project-issues/base-issue.store.ts index c483f8784..c4940337f 100644 --- a/web/store/issues/project-issues/base-issue.store.ts +++ b/web/store/issues/project-issues/base-issue.store.ts @@ -91,8 +91,9 @@ export class IssueBaseStore implements IIssueBaseStore { for (const subGroup of subGroupArray) { for (const group of groupArray) { - if (subGroup && group && _issues[subGroup][group]) _issues[subGroup][group].push(_issue.id); - else if (subGroup && group) _issues[subGroup][group] = [_issue.id]; + if (subGroup && group && _issues?.[subGroup]?.[group]) _issues[subGroup][group].push(_issue.id); + else if (subGroup && group && _issues[subGroup]) _issues[subGroup][group] = [_issue.id]; + else if (subGroup && group) _issues[subGroup] = { [group]: [_issue.id] }; } } } @@ -197,8 +198,10 @@ export class IssueBaseStore implements IIssueBaseStore { }; getGroupArray(value: string[] | string | null, isDate: boolean = false) { - if (Array.isArray(value)) return value; - else if (isDate) return [renderDateFormat(value) || "None"]; + if (Array.isArray(value)) { + if (value.length) return value; + else return ["None"]; + } else if (isDate) return [renderDateFormat(value) || "None"]; else return [value || "None"]; } }