From e9b62481b14895640384416dea0be90c752f3373 Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Sat, 13 Aug 2022 14:46:52 +0530 Subject: [PATCH] fix/minor cleanup --- packages/nc-gui-v2/components/smartsheet/Grid.vue | 6 +----- packages/nc-gui-v2/composables/useGridViewColumnWidth.ts | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/nc-gui-v2/components/smartsheet/Grid.vue b/packages/nc-gui-v2/components/smartsheet/Grid.vue index 6e071e5d17..115b590036 100644 --- a/packages/nc-gui-v2/components/smartsheet/Grid.vue +++ b/packages/nc-gui-v2/components/smartsheet/Grid.vue @@ -83,11 +83,7 @@ const { const { loadGridViewColumns, updateWidth, resizingColWidth, resizingCol } = useGridViewColumnWidth(view as any) onMounted(() => { - if (!isPublicView.value) { - loadGridViewColumns() - } else { - loadGridViewColumns(fields.value) - } + loadGridViewColumns() }) provide(IsFormInj, ref(false)) diff --git a/packages/nc-gui-v2/composables/useGridViewColumnWidth.ts b/packages/nc-gui-v2/composables/useGridViewColumnWidth.ts index 26820d311b..f26da87d31 100644 --- a/packages/nc-gui-v2/composables/useGridViewColumnWidth.ts +++ b/packages/nc-gui-v2/composables/useGridViewColumnWidth.ts @@ -36,9 +36,9 @@ export function useGridViewColumnWidth(view: Ref<(GridType & { id?: string }) | { deep: true, immediate: true }, ) - const loadGridViewColumns = async (cols?: GridColumnType[] | undefined) => { - if (!view.value?.id && !cols) return - const colsData: GridColumnType[] = cols ?? (await $api.dbView.gridColumnsList(view.value.id)) + const loadGridViewColumns = async () => { + if (!view.value?.id && !isPublic.value) return + const colsData: GridColumnType[] = isPublic.value ? columns.value : await $api.dbView.gridColumnsList(view.value.id) gridViewCols.value = colsData.reduce>( (o, col) => ({ ...o,