Empty category fix (#2627)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2023-02-13 15:36:41 +06:00 committed by GitHub
parent 32f1f80d5f
commit 17421a18b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,6 +52,9 @@
let categories: any[] = []
$: updateCategories(_class, docs, groupByKey, viewOptions, viewOptionsConfig)
const client = getClient()
const hierarchy = client.getHierarchy()
const queryId = generateId()
onDestroy(() => {
CategoryQuery.remove(queryId)
@ -75,7 +78,7 @@
const categoryFunc = viewOption as CategoryOption
if (viewOptions[viewOption.key] ?? viewOption.defaultValue) {
const f = await getResource(categoryFunc.action)
const res = await f(_class, space, groupByKey, update, queryId)
const res = hierarchy.clone(await f(_class, space, groupByKey, update, queryId))
if (res !== undefined) {
for (const category of categories) {
if (!res.includes(category)) {
@ -90,8 +93,6 @@
}
}
const client = getClient()
let itemModels: AttributeModel[]
function getHeader (_class: Ref<Class<Doc>>, groupByKey: string): void {