Browse Source

fix: handle when active_view is null

pull/9091/head
DarkPhoenix2704 5 months ago
parent
commit
505cace237
  1. 17
      packages/nc-gui/components/dashboard/TreeView/TableNode.vue
  2. 1
      packages/nc-gui/composables/useTableNew.ts

17
packages/nc-gui/components/dashboard/TreeView/TableNode.vue

@ -51,8 +51,6 @@ const { loadViews: _loadViews, navigateToView } = useViewsStore()
const { activeView, activeViewTitleOrId, viewsByTable } = storeToRefs(useViewsStore())
const { isLeftSidebarOpen } = storeToRefs(useSidebarStore())
const views = computed(() => viewsByTable.value.get(table.value.id!))
const { refreshCommandPalette } = useCommandPalette()
// todo: temp
@ -214,18 +212,21 @@ const deleteTable = () => {
function onDuplicate() {
isOptionsOpen.value = false
const views = viewsByTable.value.get(table.value.id as string)
const defaultView = views?.find((v) => v.is_default) || views?.[0]
const isOpen = ref(true)
const { close } = useDialog(resolveComponent('DlgViewCreate'), {
'modelValue': isOpen,
'title': activeView.value!.title,
'type': activeView.value!.type as ViewTypes,
'title': defaultView!.title,
'type': defaultView!.type as ViewTypes,
'tableId': table.value!.id,
'selectedViewId': activeView.value!.id,
'groupingFieldColumnId': activeView.value!.view!.fk_grp_col_id,
'selectedViewId': defaultView!.id,
'groupingFieldColumnId': defaultView!.view!.fk_grp_col_id,
'views': views,
'calendarRange': activeView.value!.view!.calendar_range,
'coverImageColumnId': activeView.value!.view!.fk_cover_image_col_id,
'calendarRange': defaultView!.view!.calendar_range,
'coverImageColumnId': defaultView!.view!.fk_cover_image_col_id,
'onUpdate:modelValue': closeDialog,
'onCreated': async (view: ViewType) => {
closeDialog()

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

@ -266,7 +266,6 @@ export function useTableNew(param: { onTableCreate?: (tableMeta: TableType) => v
table,
tables,
base,
createTable,
generateUniqueTitle,
deleteTable,

Loading…
Cancel
Save