From 20a9f3eef624de1f63e7de9c6d9d470b86aa594b Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 12 Oct 2022 17:33:29 +0530 Subject: [PATCH] chore(gui): lint Signed-off-by: Pranav C --- .../components/smartsheet/toolbar/ColumnFilter.vue | 2 +- packages/nc-gui/composables/useViewFilters.ts | 9 ++++----- packages/nc-gui/composables/useViewSorts.ts | 10 +++++----- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue b/packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue index d3048f6a4f..1594d3290c 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue @@ -87,7 +87,7 @@ watch( () => activeView.value?.id, (n, o) => { if (!nested && n !== o && (hookId || !webHook)) loadFilters(hookId as string) - } + }, ) loadFilters(hookId as string) diff --git a/packages/nc-gui/composables/useViewFilters.ts b/packages/nc-gui/composables/useViewFilters.ts index 463cfd9882..d0baba4124 100644 --- a/packages/nc-gui/composables/useViewFilters.ts +++ b/packages/nc-gui/composables/useViewFilters.ts @@ -13,9 +13,8 @@ import { useUIPermission, watch, } from '#imports' -import type { TabItem } from '~/composables/useTabs' import { TabMetaInj } from '~/context' -import type { Filter } from '~/lib' +import type { Filter, TabItem } from '~/lib' export function useViewFilters( view: Ref, @@ -53,7 +52,7 @@ export function useViewFilters( currentFilters = value if (isNestedRoot) { nestedFilters.value = value - tabMeta.value.filterState!.set(view!.value.id!, nestedFilters.value) + tabMeta.value.filterState!.set(view.value!.id!, nestedFilters.value) } nestedFilters.value = [...nestedFilters.value] reloadHook?.trigger() @@ -77,8 +76,8 @@ export function useViewFilters( const loadFilters = async (hookId?: string) => { if (nestedMode.value) { - if (isNestedRoot) - filters.value = tabMeta.value.filterState!.get(view.value.id!) || [] + // ignore restoring if not root filter group + if (isNestedRoot) filters.value = tabMeta.value.filterState!.get(view.value!.id!) || [] return } diff --git a/packages/nc-gui/composables/useViewSorts.ts b/packages/nc-gui/composables/useViewSorts.ts index f86eaf84c1..ea37001ecd 100644 --- a/packages/nc-gui/composables/useViewSorts.ts +++ b/packages/nc-gui/composables/useViewSorts.ts @@ -13,7 +13,7 @@ import { useSmartsheetStoreOrThrow, useUIPermission, } from '#imports' -import { TabItem } from '~/lib' +import type { TabItem } from '~/lib' export function useViewSorts(view: Ref, reloadData?: () => void) { const { sharedView } = useSharedView() @@ -42,7 +42,7 @@ export function useViewSorts(view: Ref, reloadData?: () => try { if (!isUIAllowed('sortSync')) { - const sortsBackup = tabMeta.value.sortsState.get(view.value.id!) + const sortsBackup = tabMeta.value.sortsState!.get(view.value!.id!) if (sortsBackup) { sorts.value = sortsBackup return @@ -61,7 +61,7 @@ export function useViewSorts(view: Ref, reloadData?: () => sorts.value[i] = sort sorts.value = [...sorts.value] reloadHook?.trigger() - tabMeta.value.sortsState.set(view.value.id!, sorts.value) + tabMeta.value.sortsState!.set(view.value!.id!, sorts.value) return } @@ -91,7 +91,7 @@ export function useViewSorts(view: Ref, reloadData?: () => $e('a:sort:add', { length: sorts?.value?.length }) - tabMeta.value.sortsState.set(view.value.id!, sorts.value) + tabMeta.value.sortsState!.set(view.value!.id!, sorts.value) } const deleteSort = async (sort: SortType, i: number) => { @@ -102,7 +102,7 @@ export function useViewSorts(view: Ref, reloadData?: () => sorts.value.splice(i, 1) sorts.value = [...sorts.value] - tabMeta.value.sortsState.set(view.value.id!, sorts.value) + tabMeta.value.sortsState!.set(view.value!.id!, sorts.value) reloadHook?.trigger() $e('a:sort:delete')