From 6450ebe66dfe7d064437824b40a123d825da403f Mon Sep 17 00:00:00 2001 From: Denis Bykhov Date: Mon, 13 Feb 2023 14:17:42 +0600 Subject: [PATCH] Fix extra no grouping (#2624) Signed-off-by: Denis Bykhov --- .../src/components/ViewOptions.svelte | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/view-resources/src/components/ViewOptions.svelte b/plugins/view-resources/src/components/ViewOptions.svelte index 0d9ac5fcfb..fb19a6cec5 100644 --- a/plugins/view-resources/src/components/ViewOptions.svelte +++ b/plugins/view-resources/src/components/ViewOptions.svelte @@ -13,10 +13,10 @@ const dispatch = createEventDispatcher() - $: grops = viewOptions.groupBy = + const groups = (viewOptions.groupBy = viewOptions.groupBy[viewOptions.groupBy.length - 1] === noCategory ? viewOptions.groupBy - : [...viewOptions.groupBy, noCategory] + : [...viewOptions.groupBy, noCategory]) const client = getClient() const hierarchy = client.getHierarchy() @@ -40,17 +40,17 @@ }) function selectGrouping (value: string, i: number) { - viewOptions.groupBy[i] = value + groups[i] = value if (value === noCategory) { - viewOptions.groupBy.length = i + 1 + groups.length = i + 1 } else if (config.groupDepth === undefined || config.groupDepth > viewOptions.groupBy.length) { - viewOptions.groupBy.length = i + 1 - viewOptions.groupBy[i + 1] = noCategory + groups.length = i + 1 + groups[i + 1] = noCategory } - viewOptions.groupBy = viewOptions.groupBy + viewOptions.groupBy = groups.length > 1 ? groups.filter((p) => p !== noCategory) : [...groups] dispatch('update', { key: 'groupBy', - value: viewOptions.groupBy.length > 1 ? viewOptions.groupBy.filter((p) => p !== noCategory) : viewOptions.groupBy + value: viewOptions.groupBy }) } @@ -62,7 +62,7 @@
- {#each grops as group, i} + {#each groups as group, i}