Browse Source

fix: on clicking table node navigate to default view rather than the first view

pull/7023/head
Pranav C 1 year ago
parent
commit
99a0857a68
  1. 5
      packages/nc-gui/composables/useTableNew.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) ?? [] 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) {
// 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({ 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, query: route.value.query,
}) })
} else } else

Loading…
Cancel
Save