From 17421a18b22184cf65a46e5397c64976344ecda8 Mon Sep 17 00:00:00 2001 From: Denis Bykhov Date: Mon, 13 Feb 2023 15:36:41 +0600 Subject: [PATCH] Empty category fix (#2627) Signed-off-by: Denis Bykhov --- .../src/components/list/ListCategories.svelte | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/view-resources/src/components/list/ListCategories.svelte b/plugins/view-resources/src/components/list/ListCategories.svelte index 11abc4a660..0e9098d2fc 100644 --- a/plugins/view-resources/src/components/list/ListCategories.svelte +++ b/plugins/view-resources/src/components/list/ListCategories.svelte @@ -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>, groupByKey: string): void {