Skip to content

Commit

Permalink
fix(nc-gui): shared base breadcrumb link issue #7571
Browse files Browse the repository at this point in the history
  • Loading branch information
rameshmane7218 committed Feb 8, 2024
1 parent c1c6f62 commit 4675153
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
3 changes: 2 additions & 1 deletion packages/nc-gui/components/smartsheet/toolbar/ViewInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const openedBaseUrl = computed(() => {
return `${window.location.origin}/#${baseUrl({
id: base.value.id!,
type: 'database',
isSharedBase: isSharedBase.value,
})}`
})
</script>
Expand Down Expand Up @@ -112,7 +113,7 @@ const openedBaseUrl = computed(() => {
<NuxtLink
v-else
class="!text-inherit !underline-transparent !hover:(text-black underline-gray-600)"
:to="tableUrl({ table: activeTable, completeUrl: true })"
:to="tableUrl({ table: activeTable, completeUrl: true, isSharedBase })"
>
{{ activeTable?.title }}
</NuxtLink>
Expand Down
25 changes: 17 additions & 8 deletions packages/nc-gui/store/tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,19 +214,28 @@ export const useTablesStore = defineStore('tablesStore', () => {
}
}

const tableUrl = ({ table, completeUrl }: { table: TableType; completeUrl: boolean }) => {
const base = basesStore.bases.get(table.base_id!)
if (!base) return
const tableUrl = ({ table, completeUrl, isSharedBase }: { table: TableType; completeUrl: boolean; isSharedBase?: boolean }) => {
let base
if (!isSharedBase) {
base = basesStore.bases.get(table.base_id!)
if (!base) return
}

const nuxtPageName = 'index-typeOrId-baseId-index-index-viewId-viewTitle'

const url = router.resolve({
name: nuxtPageName,
params: {
typeOrId: workspaceStore.activeWorkspaceId,
baseId: base.id,
viewId: table.id,
},
params: isSharedBase
? {
typeOrId: route.value.params.typeOrId,
baseId: route.value.params.baseId,
viewId: route.value.params.viewId,
}
: {
typeOrId: workspaceStore.activeWorkspaceId,
baseId: base?.id,
viewId: table.id,
},
})

if (completeUrl) return `${window.location.origin}/${url.href}`
Expand Down

0 comments on commit 4675153

Please sign in to comment.