Browse Source

fix(gui-v2): avoid watch logic to trigger even after signout

pull/3492/head
Wing-Kam Wong 2 years ago
parent
commit
53409fb347
  1. 4
      packages/nc-gui-v2/components/smartsheet-toolbar/ColumnFilterMenu.vue
  2. 6
      packages/nc-gui-v2/composables/useViewColumns.ts

4
packages/nc-gui-v2/components/smartsheet-toolbar/ColumnFilterMenu.vue

@ -10,6 +10,8 @@ const isPublic = inject(IsPublicInj, ref(false))
const { filterAutoSave } = useGlobal() const { filterAutoSave } = useGlobal()
const state = useGlobal()
const filterComp = ref<typeof ColumnFilter>() const filterComp = ref<typeof ColumnFilter>()
const { nestedFilters } = useSmartsheetStoreOrThrow() const { nestedFilters } = useSmartsheetStoreOrThrow()
@ -26,7 +28,7 @@ const { filters, loadFilters } = useViewFilters(
const filtersLength = ref(0) const filtersLength = ref(0)
watchEffect(async () => { watchEffect(async () => {
if (activeView?.value) { if (activeView?.value && state.signedIn.value) {
await loadFilters() await loadFilters()
filtersLength.value = filters.value.length || 0 filtersLength.value = filters.value.length || 0

6
packages/nc-gui-v2/composables/useViewColumns.ts

@ -202,7 +202,11 @@ export function useViewColumns(view: Ref<ViewType> | undefined, meta: ComputedRe
}) })
// reload view columns when table meta changes // reload view columns when table meta changes
watch(meta, () => loadViewColumns()) watch(meta, async (newVal, oldVal) => {
if (newVal !== oldVal && meta.value) {
await loadViewColumns()
}
})
return { return {
fields, fields,

Loading…
Cancel
Save