diff --git a/plugins/task-resources/src/components/kanban/KanbanView.svelte b/plugins/task-resources/src/components/kanban/KanbanView.svelte index 33bcc2ab6f..730d7fe049 100644 --- a/plugins/task-resources/src/components/kanban/KanbanView.svelte +++ b/plugins/task-resources/src/components/kanban/KanbanView.svelte @@ -26,7 +26,7 @@ } from '@hcengineering/core' import { Item, Kanban as KanbanUI } from '@hcengineering/kanban' import { getResource } from '@hcengineering/platform' - import { createQuery, getClient, ActionContext } from '@hcengineering/presentation' + import { ActionContext, createQuery, getClient } from '@hcengineering/presentation' import { Project, Task, TaskGrouping, TaskOrdering } from '@hcengineering/task' import { ColorDefinition, @@ -173,20 +173,15 @@ if (viewOptions[viewOption.key] ?? viewOption.defaultValue) { const categoryAction = await getResource(categoryFunc.action) - const spaces = getCategorySpaces(categories) - if (space !== undefined) { - spaces.push(space) + let spaces = getCategorySpaces(categories) + if (spaces.length === 0) { + const set = new Set(docs.map((p) => p.space)) + spaces = Array.from(set) } - const res = await categoryAction( - _class, - spaces.length > 0 ? { space: { $in: Array.from(spaces.values()) } } : {}, - space, - groupByKey, - update, - queryId, - viewlet.descriptor - ) + const query = spaces.length > 0 ? { space: { $in: Array.from(spaces.values()) } } : space ? { space } : {} + + const res = await categoryAction(_class, query, space, groupByKey, update, queryId, viewlet.descriptor) if (res !== undefined) { categories = res break diff --git a/plugins/task-resources/src/index.ts b/plugins/task-resources/src/index.ts index 6d336e99d6..3cc31b72fc 100644 --- a/plugins/task-resources/src/index.ts +++ b/plugins/task-resources/src/index.ts @@ -200,7 +200,6 @@ async function statusSort ( const type = types.splice(index, 1)[0] for (let index = 0; index < type.statuses.length; index++) { const st = type.statuses[index] - if (!value.includes(st._id)) continue const prev = index > 0 ? res.get(type.statuses[index - 1]._id) : prevRank const next = index < type.statuses.length - 1 ? res.get(type.statuses[index + 1]._id) : undefined const rank = calcRank(