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> <script lang="ts" setup>
import { onMounted } from '@vue/runtime-core'
import { isVirtualCol } from 'nocodb-sdk' import { isVirtualCol } from 'nocodb-sdk'
import { import {
ActiveViewInj, 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 isRowEmpty = (record: any, col: any) => {
const val = record.row[col.title] const val = record.row[col.title]
if (!val) return true if (!val) return true
@ -154,6 +144,11 @@ const expandedFormOnRowIdDlg = computed({
// reload table data reload hook as fallback to rowdatareload // reload table data reload hook as fallback to rowdatareload
provide(ReloadRowDataHookInj, reloadViewDataHook) provide(ReloadRowDataHookInj, reloadViewDataHook)
onMounted(async () => {
await loadData()
await loadGalleryData()
})
</script> </script>
<template> <template>
@ -170,7 +165,9 @@ provide(ReloadRowDataHookInj, reloadViewDataHook)
<a-carousel v-if="!reloadAttachments && attachments(record).length" autoplay class="gallery-carousel" arrows> <a-carousel v-if="!reloadAttachments && attachments(record).length" autoplay class="gallery-carousel" arrows>
<template #customPaging> <template #customPaging>
<a> <a>
<div class="pt-[12px]"><div></div></div> <div class="pt-[12px]">
<div></div>
</div>
</a> </a>
</template> </template>
<template #prevArrow> <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 */ /** Handle view creation */
function onCreate(view: ViewType) { function onCreate(view: ViewType) {
views.value.push(view) views.value.push(view)
activeView.value = view
router.push({ params: { viewTitle: view.title || '' } }) router.push({ params: { viewTitle: view.title || '' } })
modalOpen = false modalOpen = false
$e('a:view:create', { view: view.type }) $e('a:view:create', { view: view.type })

Loading…
Cancel
Save