Browse Source

fix(gui): convert computed dependencies to reactive for proper functioning

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3370/head
Pranav C 2 years ago
parent
commit
9755191104
  1. 7
      packages/nc-gui/composables/useViewFilters.ts
  2. 1
      packages/nc-gui/composables/useViewSorts.ts

7
packages/nc-gui/composables/useViewFilters.ts

@ -22,9 +22,10 @@ export function useViewFilters(
parentId?: string, parentId?: string,
autoApply?: ComputedRef<boolean>, autoApply?: ComputedRef<boolean>,
reloadData?: () => void, reloadData?: () => void,
currentFilters?: Filter[], _currentFilters?: Filter[],
isNestedRoot?: boolean, isNestedRoot?: boolean,
) { ) {
let currentFilters = $ref(_currentFilters)
const reloadHook = inject(ReloadViewDataHookInj) const reloadHook = inject(ReloadViewDataHookInj)
const { nestedFilters } = useSmartsheetStoreOrThrow() const { nestedFilters } = useSmartsheetStoreOrThrow()
@ -44,7 +45,9 @@ export function useViewFilters(
const tabMeta = inject(TabMetaInj, ref({ filterState: new Map() } as TabItem)) const tabMeta = inject(TabMetaInj, ref({ filterState: new Map() } as TabItem))
const filters = computed<Filter[]>({ const filters = computed<Filter[]>({
get: () => (nestedMode.value ? currentFilters! : _filters.value), get: () => {
return nestedMode.value ? currentFilters! : _filters.value
},
set: (value: Filter[]) => { set: (value: Filter[]) => {
if (nestedMode.value) { if (nestedMode.value) {
currentFilters = value currentFilters = value

1
packages/nc-gui/composables/useViewSorts.ts

@ -13,6 +13,7 @@ import {
useSmartsheetStoreOrThrow, useSmartsheetStoreOrThrow,
useUIPermission, useUIPermission,
} from '#imports' } from '#imports'
import { TabItem } from '~/lib'
export function useViewSorts(view: Ref<ViewType | undefined>, reloadData?: () => void) { export function useViewSorts(view: Ref<ViewType | undefined>, reloadData?: () => void) {
const { sharedView } = useSharedView() const { sharedView } = useSharedView()

Loading…
Cancel
Save