From 64840fe2dff325dcfa3e7b3c8dfbb99a29183494 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 31 May 2023 17:35:27 +0530 Subject: [PATCH] fix: load the view columns from view(only avail in public) Signed-off-by: Pranav C --- packages/nc-gui/composables/useGridViewColumnWidth.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/composables/useGridViewColumnWidth.ts b/packages/nc-gui/composables/useGridViewColumnWidth.ts index 4e7786c250..66b180c3ae 100644 --- a/packages/nc-gui/composables/useGridViewColumnWidth.ts +++ b/packages/nc-gui/composables/useGridViewColumnWidth.ts @@ -13,7 +13,7 @@ import { watch, } from '#imports' -export function useGridViewColumnWidth(view: Ref) { +export function useGridViewColumnWidth(view: Ref<(ViewType & { columns?: GridColumnType[] }) | undefined>) { const { css, load: loadCss, unload: unloadCss } = useStyleTag('') const { isUIAllowed } = useUIPermission() @@ -52,7 +52,9 @@ export function useGridViewColumnWidth(view: Ref) { const loadGridViewColumns = async () => { 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>( (o, col) => ({ ...o,