From 0a27efe54367ee8ef4c62b810915912091271a5a Mon Sep 17 00:00:00 2001
From: braks <78412429+bcakmakoglu@users.noreply.github.com>
Date: Wed, 27 Jul 2022 16:46:28 +0200
Subject: [PATCH] chore: shelve
---
packages/nc-gui-v2/components.d.ts | 1 +
.../components/smartsheet/Sidebar.vue | 44 ++++++++++---------
packages/nc-gui-v2/composables/useViews.ts | 17 ++++---
3 files changed, 35 insertions(+), 27 deletions(-)
diff --git a/packages/nc-gui-v2/components.d.ts b/packages/nc-gui-v2/components.d.ts
index f5e940f2ba..ed57313599 100644
--- a/packages/nc-gui-v2/components.d.ts
+++ b/packages/nc-gui-v2/components.d.ts
@@ -38,6 +38,7 @@ declare module '@vue/runtime-core' {
AMenuItemGroup: typeof import('ant-design-vue/es')['MenuItemGroup']
AModal: typeof import('ant-design-vue/es')['Modal']
APagination: typeof import('ant-design-vue/es')['Pagination']
+ APopconfirm: typeof import('ant-design-vue/es')['Popconfirm']
ARow: typeof import('ant-design-vue/es')['Row']
ASelect: typeof import('ant-design-vue/es')['Select']
ASelectOption: typeof import('ant-design-vue/es')['SelectOption']
diff --git a/packages/nc-gui-v2/components/smartsheet/Sidebar.vue b/packages/nc-gui-v2/components/smartsheet/Sidebar.vue
index 6b5c3d10d8..b97bf86063 100644
--- a/packages/nc-gui-v2/components/smartsheet/Sidebar.vue
+++ b/packages/nc-gui-v2/components/smartsheet/Sidebar.vue
@@ -1,42 +1,46 @@
@@ -277,5 +281,3 @@ const onViewCreate = (view) => {
-
-
diff --git a/packages/nc-gui-v2/composables/useViews.ts b/packages/nc-gui-v2/composables/useViews.ts
index b540b20794..577acf63aa 100644
--- a/packages/nc-gui-v2/composables/useViews.ts
+++ b/packages/nc-gui-v2/composables/useViews.ts
@@ -1,15 +1,20 @@
import type { FormType, GalleryType, GridType, KanbanType, TableType } from 'nocodb-sdk'
-import type { Ref } from 'vue'
+import type { MaybeRef } from '@vueuse/core'
import { useNuxtApp } from '#app'
-export default function (meta: Ref) {
- const views = ref<(GridType | FormType | KanbanType | GalleryType)[]>()
+export default function (meta: MaybeRef) {
+ let views = $ref<(GridType | FormType | KanbanType | GalleryType)[]>([])
const { $api } = useNuxtApp()
const loadViews = async () => {
- if (meta.value?.id)
- views.value = (await $api.dbView.list(meta.value?.id)).list as (GridType | FormType | KanbanType | GalleryType)[]
+ const _meta = unref(meta)
+
+ if (_meta && _meta.id) {
+ views = (await $api.dbView.list(_meta.id)).list as (GridType | FormType | KanbanType | GalleryType)[]
+ }
}
- return { views, loadViews }
+ watch(() => meta, loadViews, { immediate: true })
+
+ return { views: $$(views), loadViews }
}