From f0ece1c6b72e217479c81cb28b80bf0045243c2d Mon Sep 17 00:00:00 2001 From: rahulramesha <71900764+rahulramesha@users.noreply.github.com> Date: Fri, 24 May 2024 19:39:28 +0530 Subject: [PATCH] optionally chain sub issue count (#4585) --- web/components/issues/issue-layouts/list/block.tsx | 2 +- .../issues/issue-layouts/properties/all-properties.tsx | 2 +- .../issue-layouts/spreadsheet/columns/sub-issue-column.tsx | 2 +- web/components/issues/issue-layouts/spreadsheet/issue-row.tsx | 2 +- web/components/issues/sub-issues/issue-list-item.tsx | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/web/components/issues/issue-layouts/list/block.tsx b/web/components/issues/issue-layouts/list/block.tsx index 3cf82cd31..4f5c7784d 100644 --- a/web/components/issues/issue-layouts/list/block.tsx +++ b/web/components/issues/issue-layouts/list/block.tsx @@ -68,7 +68,7 @@ export const IssueBlock = observer((props: IssueBlockProps) => { setPeekIssue({ workspaceSlug, projectId: issue.project_id, issueId: issue.id, nestingLevel: nestingLevel }); const issue = issuesMap[issueId]; - const subIssuesCount = issue.sub_issues_count; + const subIssuesCount = issue?.sub_issues_count ?? 0; const { isMobile } = usePlatformOS(); diff --git a/web/components/issues/issue-layouts/properties/all-properties.tsx b/web/components/issues/issue-layouts/properties/all-properties.tsx index 79f2fca70..22f14833e 100644 --- a/web/components/issues/issue-layouts/properties/all-properties.tsx +++ b/web/components/issues/issue-layouts/properties/all-properties.tsx @@ -63,7 +63,7 @@ export const IssueProperties: React.FC = observer((props) => { const currentLayout = `${activeLayout} layout`; // derived values const stateDetails = getStateById(issue.state_id); - const subIssueCount = issue.sub_issues_count; + const subIssueCount = issue?.sub_issues_count ?? 0; const issueOperations = useMemo( () => ({ diff --git a/web/components/issues/issue-layouts/spreadsheet/columns/sub-issue-column.tsx b/web/components/issues/issue-layouts/spreadsheet/columns/sub-issue-column.tsx index c597bc698..8a6d26ac6 100644 --- a/web/components/issues/issue-layouts/spreadsheet/columns/sub-issue-column.tsx +++ b/web/components/issues/issue-layouts/spreadsheet/columns/sub-issue-column.tsx @@ -19,7 +19,7 @@ export const SpreadsheetSubIssueColumn: React.FC = observer((props: Props // hooks const { workspaceSlug } = useAppRouter(); // derived values - const subIssueCount = issue.sub_issues_count; + const subIssueCount = issue?.sub_issues_count ?? 0; const redirectToIssueDetail = () => { router.push({ diff --git a/web/components/issues/issue-layouts/spreadsheet/issue-row.tsx b/web/components/issues/issue-layouts/spreadsheet/issue-row.tsx index 03854fcad..eb33a13f3 100644 --- a/web/components/issues/issue-layouts/spreadsheet/issue-row.tsx +++ b/web/components/issues/issue-layouts/spreadsheet/issue-row.tsx @@ -203,7 +203,7 @@ const IssueRowDetails = observer((props: IssueRowDetailsProps) => { }; const disableUserActions = !canEditProperties(issueDetail.project_id); - const subIssuesCount = issueDetail.sub_issues_count; + const subIssuesCount = issueDetail?.sub_issues_count ?? 0; return ( <> diff --git a/web/components/issues/sub-issues/issue-list-item.tsx b/web/components/issues/sub-issues/issue-list-item.tsx index a3c3e9946..e0c57f4c4 100644 --- a/web/components/issues/sub-issues/issue-list-item.tsx +++ b/web/components/issues/sub-issues/issue-list-item.tsx @@ -61,7 +61,7 @@ export const IssueListItem: React.FC = observer((props) => { undefined; const subIssueHelpers = subIssueHelpersByIssueId(parentIssueId); - const subIssueCount = issue?.sub_issues_count || 0; + const subIssueCount = issue?.sub_issues_count ?? 0; const handleIssuePeekOverview = (issue: TIssue) => workspaceSlug &&