Browse Source

fix: load the view columns from view(only avail in public)

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5776/head
Pranav C 2 years ago
parent
commit
64840fe2df
  1. 6
      packages/nc-gui/composables/useGridViewColumnWidth.ts

6
packages/nc-gui/composables/useGridViewColumnWidth.ts

@ -13,7 +13,7 @@ import {
watch, watch,
} from '#imports' } from '#imports'
export function useGridViewColumnWidth(view: Ref<ViewType | undefined>) { export function useGridViewColumnWidth(view: Ref<(ViewType & { columns?: GridColumnType[] }) | undefined>) {
const { css, load: loadCss, unload: unloadCss } = useStyleTag('') const { css, load: loadCss, unload: unloadCss } = useStyleTag('')
const { isUIAllowed } = useUIPermission() const { isUIAllowed } = useUIPermission()
@ -52,7 +52,9 @@ export function useGridViewColumnWidth(view: Ref<ViewType | undefined>) {
const loadGridViewColumns = async () => { const loadGridViewColumns = async () => {
if (!view.value?.id && !isPublic.value) return if (!view.value?.id && !isPublic.value) return
const colsData: GridColumnType[] = (isPublic.value ? columns.value : await $api.dbView.gridColumnsList(view.value!.id!)) ?? [] const colsData: GridColumnType[] =
(isPublic.value ? view.value?.columns : await $api.dbView.gridColumnsList(view.value!.id!)) ?? []
gridViewCols.value = colsData.reduce<Record<string, GridColumnType>>( gridViewCols.value = colsData.reduce<Record<string, GridColumnType>>(
(o, col) => ({ (o, col) => ({
...o, ...o,

Loading…
Cancel
Save