Browse Source

fix(nc-gui): switch to data on create new table

pull/6820/head
DarkPhoenix2704 1 year ago
parent
commit
896e524eb8
  1. 7
      packages/nc-gui/composables/useTableNew.ts

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

@ -49,6 +49,8 @@ export function useTableNew(param: { onTableCreate?: (tableMeta: TableType) => v
const { loadTables, baseUrl, isXcdbBase } = useBase() const { loadTables, baseUrl, isXcdbBase } = useBase()
const { loadViews } = useViewsStore()
const { openedViewsTab, viewsByTable } = storeToRefs(useViewsStore()) const { openedViewsTab, viewsByTable } = storeToRefs(useViewsStore())
const workspaceId = computed(() => route.value.params.typeOrId as string) const workspaceId = computed(() => route.value.params.typeOrId as string)
@ -80,10 +82,11 @@ export function useTableNew(param: { onTableCreate?: (tableMeta: TableType) => v
baseIdOrBaseId = route.value.params.baseId as string baseIdOrBaseId = route.value.params.baseId as string
} }
const views = viewsByTable.value.get(table.id as string) ?? []
await getMeta(table.id as string, (route.value.params?.viewId as string) !== table.id) await getMeta(table.id as string, (route.value.params?.viewId as string) !== table.id)
await loadViews({ tableId: table.id as string })
const views = viewsByTable.value.get(table.id as string) ?? []
if (openedViewsTab.value !== 'view' && views.length && views[0].id) { if (openedViewsTab.value !== 'view' && views.length && views[0].id) {
await navigateTo({ await navigateTo({
path: `/${workspaceIdOrType}/${baseIdOrBaseId}/${table?.id}/${views[0].id}/${openedViewsTab.value}`, path: `/${workspaceIdOrType}/${baseIdOrBaseId}/${table?.id}/${views[0].id}/${openedViewsTab.value}`,

Loading…
Cancel
Save