Browse Source

Merge pull request #7023 from nocodb/fix/6798-default-view-issue

fix: on clicking table node navigate to default view
pull/7035/head
Raju Udava 12 months ago committed by GitHub
parent
commit
34f6bb1a66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      packages/nc-gui/composables/useTableNew.ts
  2. 7
      packages/nc-gui/store/views.ts

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

@ -88,8 +88,11 @@ export function useTableNew(param: { onTableCreate?: (tableMeta: TableType) => v
const views = viewsByTable.value.get(table.id as string) ?? []
if (openedViewsTab.value !== 'view' && views.length && views[0].id) {
// find the default view and navigate to it, if not found navigate to the first one
const defaultView = views.find((v) => v.is_default) || views[0]
await navigateTo({
path: `/${workspaceIdOrType}/${baseIdOrBaseId}/${table?.id}/${views[0].id}/${openedViewsTab.value}`,
path: `/${workspaceIdOrType}/${baseIdOrBaseId}/${table?.id}/${defaultView.id}/${openedViewsTab.value}`,
query: route.value.query,
})
} else

7
packages/nc-gui/store/views.ts

@ -54,7 +54,12 @@ export const useViewsStore = defineStore('viewsStore', () => {
const { activeTable } = storeToRefs(useTablesStore())
const activeViewTitleOrId = computed(() => {
if (!route.value.params.viewTitle?.length) return views.value.length ? views.value[0].id : undefined
if (!route.value.params.viewTitle?.length) {
// find the default view and navigate to it, if not found navigate to the first one
const defaultView = views.value?.find((v) => v.is_default) || views.value?.[0]
return defaultView?.id
}
return route.value.params.viewTitle
})

Loading…
Cancel
Save