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

View File

@ -110,7 +110,7 @@ const useIssuesView = () => {
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,