fix: kanban loading state (#514)

This commit is contained in:
Aaryan Khandelwal 2023-03-23 23:36:52 +05:30 committed by GitHub
parent 2f2caaaf6e
commit 765cfdbf7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -96,6 +96,7 @@ export const IssuesView: React.FC<Props> = ({
groupByProperty: selectedGroup, groupByProperty: selectedGroup,
orderBy, orderBy,
filters, filters,
isNotEmpty,
setFilters, setFilters,
params, params,
} = useIssuesView(); } = useIssuesView();
@ -580,7 +581,7 @@ export const IssuesView: React.FC<Props> = ({
)} )}
</StrictModeDroppable> </StrictModeDroppable>
{groupedByIssues ? ( {groupedByIssues ? (
Object.keys(groupedByIssues).length > 0 ? ( isNotEmpty ? (
<> <>
{issueView === "list" ? ( {issueView === "list" ? (
<AllLists <AllLists

View File

@ -110,7 +110,7 @@ const useIssuesView = () => {
const statesList = getStatesList(states ?? {}); const statesList = getStatesList(states ?? {});
const stateIds = statesList.map((state) => state.id); const stateIds = statesList.map((state) => state.id);
let emptyStatesObject: { [key: string]: [] } = {}; const emptyStatesObject: { [key: string]: [] } = {};
for (let i = 0; i < stateIds.length; i++) { for (let i = 0; i < stateIds.length; i++) {
emptyStatesObject[stateIds[i]] = []; emptyStatesObject[stateIds[i]] = [];
} }
@ -123,11 +123,16 @@ const useIssuesView = () => {
const issuesToGroup = cycleIssues ?? moduleIssues ?? projectIssues; const issuesToGroup = cycleIssues ?? moduleIssues ?? projectIssues;
if (Array.isArray(issuesToGroup)) return { allIssues: issuesToGroup }; 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; return issuesToGroup;
}, [projectIssues, cycleIssues, moduleIssues]); }, [projectIssues, cycleIssues, moduleIssues]);
const isEmpty =
Object.values(groupedByIssues ?? {}).every((group) => group.length === 0) ||
Object.keys(groupedByIssues ?? {}).length === 0;
return { return {
groupedByIssues, groupedByIssues,
issueView, issueView,
@ -140,6 +145,7 @@ const useIssuesView = () => {
filters, filters,
setFilters, setFilters,
params, params,
isNotEmpty: !isEmpty,
resetFilterToDefault, resetFilterToDefault,
setNewFilterDefaultView, setNewFilterDefaultView,
setIssueViewToKanban, setIssueViewToKanban,