diff --git a/apps/app/components/core/issues-view.tsx b/apps/app/components/core/issues-view.tsx index d0cedffbd..46a92d43c 100644 --- a/apps/app/components/core/issues-view.tsx +++ b/apps/app/components/core/issues-view.tsx @@ -96,6 +96,7 @@ export const IssuesView: React.FC = ({ groupByProperty: selectedGroup, orderBy, filters, + isNotEmpty, setFilters, params, } = useIssuesView(); @@ -580,7 +581,7 @@ export const IssuesView: React.FC = ({ )} {groupedByIssues ? ( - Object.keys(groupedByIssues).length > 0 ? ( + isNotEmpty ? ( <> {issueView === "list" ? ( { const statesList = getStatesList(states ?? {}); const stateIds = statesList.map((state) => state.id); - let emptyStatesObject: { [key: string]: [] } = {}; + const emptyStatesObject: { [key: string]: [] } = {}; for (let i = 0; i < stateIds.length; i++) { emptyStatesObject[stateIds[i]] = []; } @@ -123,11 +123,16 @@ const useIssuesView = () => { const issuesToGroup = cycleIssues ?? moduleIssues ?? projectIssues; if (Array.isArray(issuesToGroup)) return { allIssues: issuesToGroup }; - if (groupByProperty === "state") return Object.assign(emptyStatesObject, issuesToGroup); + if (groupByProperty === "state") + return issuesToGroup ? Object.assign(emptyStatesObject, issuesToGroup) : undefined; return issuesToGroup; }, [projectIssues, cycleIssues, moduleIssues]); + const isEmpty = + Object.values(groupedByIssues ?? {}).every((group) => group.length === 0) || + Object.keys(groupedByIssues ?? {}).length === 0; + return { groupedByIssues, issueView, @@ -140,6 +145,7 @@ const useIssuesView = () => { filters, setFilters, params, + isNotEmpty: !isEmpty, resetFilterToDefault, setNewFilterDefaultView, setIssueViewToKanban,