Browse Source

fix(gui): avoid invoking gallery view meta api multiple times

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3655/head
Pranav C 2 years ago
parent
commit
fb6dd6ed09
  1. 21
      packages/nc-gui/components/smartsheet/Gallery.vue
  2. 1
      packages/nc-gui/components/smartsheet/sidebar/index.vue

21
packages/nc-gui/components/smartsheet/Gallery.vue

@ -1,4 +1,5 @@
<script lang="ts" setup>
import { onMounted } from '@vue/runtime-core'
import { isVirtualCol } from 'nocodb-sdk'
import {
ActiveViewInj,
@ -69,17 +70,6 @@ const coverImageColumn: any = $(
),
)
watch(
[meta, view],
async () => {
if (meta?.value && view?.value) {
await loadData()
await loadGalleryData()
}
},
{ immediate: true },
)
const isRowEmpty = (record: any, col: any) => {
const val = record.row[col.title]
if (!val) return true
@ -154,6 +144,11 @@ const expandedFormOnRowIdDlg = computed({
// reload table data reload hook as fallback to rowdatareload
provide(ReloadRowDataHookInj, reloadViewDataHook)
onMounted(async () => {
await loadData()
await loadGalleryData()
})
</script>
<template>
@ -170,7 +165,9 @@ provide(ReloadRowDataHookInj, reloadViewDataHook)
<a-carousel v-if="!reloadAttachments && attachments(record).length" autoplay class="gallery-carousel" arrows>
<template #customPaging>
<a>
<div class="pt-[12px]"><div></div></div>
<div class="pt-[12px]">
<div></div>
</div>
</a>
</template>
<template #prevArrow>

1
packages/nc-gui/components/smartsheet/sidebar/index.vue

@ -93,7 +93,6 @@ function openModal({ type, title = '', copyViewId }: { type: ViewTypes; title: s
/** Handle view creation */
function onCreate(view: ViewType) {
views.value.push(view)
activeView.value = view
router.push({ params: { viewTitle: view.title || '' } })
modalOpen = false
$e('a:view:create', { view: view.type })

Loading…
Cancel
Save