From 2abc5eb68cf54414bc73153df2591ab39cb1310e Mon Sep 17 00:00:00 2001 From: Dakshesh Jain <65905942+dakshesh14@users.noreply.github.com> Date: Mon, 20 Nov 2023 12:22:43 +0530 Subject: [PATCH] fix: delete issues in spreadsheet doesn't work (#2718) Co-authored-by: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> --- .../spreadsheet/roots/project-root.tsx | 14 +++++++++++++- .../issue-layouts/spreadsheet/spreadsheet-view.tsx | 2 -- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/web/components/issues/issue-layouts/spreadsheet/roots/project-root.tsx b/web/components/issues/issue-layouts/spreadsheet/roots/project-root.tsx index f049914df..a14a8d803 100644 --- a/web/components/issues/issue-layouts/spreadsheet/roots/project-root.tsx +++ b/web/components/issues/issue-layouts/spreadsheet/roots/project-root.tsx @@ -41,6 +41,18 @@ export const ProjectSpreadsheetLayout: React.FC = observer(() => { [issueFilterStore, projectId, workspaceSlug] ); + const handleIssueAction = async (issue: IIssue, action: "copy" | "delete" | "edit") => { + if (!workspaceSlug || !projectId || !user) return; + + if (action === "delete") { + issueDetailStore.deleteIssue(workspaceSlug.toString(), projectId.toString(), issue.id); + issueStore.removeIssueFromStructure(null, null, issue); + } else if (action === "edit") { + issueDetailStore.updateIssue(workspaceSlug.toString(), projectId.toString(), issue.id, issue); + issueStore.updateIssueStructure(null, null, issue); + } + }; + const handleUpdateIssue = useCallback( (issue: IIssue, data: Partial) => { if (!workspaceSlug || !projectId || !user) return; @@ -65,7 +77,7 @@ export const ProjectSpreadsheetLayout: React.FC = observer(() => { members={projectMembers?.map((m) => m.member)} labels={projectLabels || undefined} states={projectId ? projectStateStore.states?.[projectId.toString()] : undefined} - handleIssueAction={() => {}} + handleIssueAction={handleIssueAction} handleUpdateIssue={handleUpdateIssue} disableUserActions={false} enableQuickCreateIssue diff --git a/web/components/issues/issue-layouts/spreadsheet/spreadsheet-view.tsx b/web/components/issues/issue-layouts/spreadsheet/spreadsheet-view.tsx index 20fcba939..c258d5437 100644 --- a/web/components/issues/issue-layouts/spreadsheet/spreadsheet-view.tsx +++ b/web/components/issues/issue-layouts/spreadsheet/spreadsheet-view.tsx @@ -46,8 +46,6 @@ export const SpreadsheetView: React.FC = observer((props) => { issueId: string; } | null>(null); - const [isInlineCreateIssueFormOpen, setIsInlineCreateIssueFormOpen] = useState(false); - const [isScrolled, setIsScrolled] = useState(false); const containerRef = useRef(null);