From b725c69882102436b382eca9d6e19e89e8e44a6f Mon Sep 17 00:00:00 2001 From: rahulramesha <71900764+rahulramesha@users.noreply.github.com> Date: Fri, 10 May 2024 16:14:15 +0530 Subject: [PATCH] list and spreadsheet sub issues mutation issue (#4415) --- web/components/issues/issue-detail/parent-select.tsx | 6 ++++-- web/components/issues/issue-layouts/list/block.tsx | 7 +++++-- .../issues/issue-layouts/spreadsheet/issue-row.tsx | 7 +++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/web/components/issues/issue-detail/parent-select.tsx b/web/components/issues/issue-detail/parent-select.tsx index 6994dd5bd..d8399fc02 100644 --- a/web/components/issues/issue-detail/parent-select.tsx +++ b/web/components/issues/issue-detail/parent-select.tsx @@ -34,7 +34,7 @@ export const IssueParentSelect: React.FC = observer((props) isParentIssueModalOpen, toggleParentIssueModal, removeSubIssue, - subIssues: { setSubIssueHelpers }, + subIssues: { setSubIssueHelpers, fetchSubIssues }, } = useIssueDetail(); // derived values @@ -47,7 +47,8 @@ export const IssueParentSelect: React.FC = observer((props) try { await issueOperations.update(workspaceSlug, projectId, issueId, { parent_id: _issueId }); await issueOperations.fetch(workspaceSlug, projectId, issueId); - toggleParentIssueModal(issueId); + _issueId && (await fetchSubIssues(workspaceSlug, projectId, _issueId)); + toggleParentIssueModal(null); } catch (error) { console.error("something went wrong while fetching the issue"); } @@ -62,6 +63,7 @@ export const IssueParentSelect: React.FC = observer((props) try { setSubIssueHelpers(parentIssueId, "issue_loader", issueId); await removeSubIssue(workspaceSlug, projectId, parentIssueId, issueId); + await fetchSubIssues(workspaceSlug, projectId, parentIssueId); setSubIssueHelpers(parentIssueId, "issue_loader", issueId); } catch (error) { setToast({ diff --git a/web/components/issues/issue-layouts/list/block.tsx b/web/components/issues/issue-layouts/list/block.tsx index c68abac14..46499020e 100644 --- a/web/components/issues/issue-layouts/list/block.tsx +++ b/web/components/issues/issue-layouts/list/block.tsx @@ -57,11 +57,14 @@ export const IssueBlock: React.FC = observer((props: IssueBlock setPeekIssue({ workspaceSlug, projectId: issue.project_id, issueId: issue.id }); const issue = issuesMap[issueId]; + const subIssues = subIssuesStore.subIssuesByIssueId(issueId); const { isMobile } = usePlatformOS(); if (!issue) return null; const canEditIssueProperties = canEditProperties(issue.project_id); const projectIdentifier = getProjectIdentifierById(issue.project_id); + // if sub issues have been fetched for the issue, use that for count or use issue's sub_issues_count + const subIssuesCount = subIssues ? subIssues.length : issue.sub_issues_count; const paddingLeft = `${spacingLeft}px`; @@ -90,11 +93,11 @@ export const IssueBlock: React.FC = observer((props: IssueBlock } )} > -
+
- {issue.sub_issues_count > 0 && ( + {subIssuesCount > 0 && (