Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix: render a-carousel only after component mounted

Ramesh Mane819d2f25e658
diff --git a/packages/nc-gui/components/n/RecordPicker/Item.vue b/packages/nc-gui/components/n/RecordPicker/Item.vue
index ba056ef140..3df50a9fe8 100644
--- a/packages/nc-gui/components/n/RecordPicker/Item.vue
+++ b/packages/nc-gui/components/n/RecordPicker/Item.vue
@@ -30,6 +30,8 @@ const { fields, fieldsToDisplay, displayField } = toRefs(props)
const { getPossibleAttachmentSrc } = useAttachment()
+const { isMounted } = useIsMounted()
+
interface Attachment {
url: string
title: string
@@ -70,7 +72,7 @@ useProvideSmartsheetRowStore(row)
>
<div class="flex items-center gap-3">
<template v-if="attachmentField">
- <div v-if="attachments && attachments.length">
+ <div v-if="isMounted && attachments && attachments.length">
<a-carousel autoplay class="!w-11 !h-11 !max-h-11 !max-w-11">
<template #customPaging> </template>
<template v-for="(attachmentObj, index) in attachments">
diff --git a/packages/nc-gui/components/nc/List/RecordItem.vue b/packages/nc-gui/components/nc/List/RecordItem.vue
index 020f579824..dbe0cd90b5 100644
--- a/packages/nc-gui/components/nc/List/RecordItem.vue
+++ b/packages/nc-gui/components/nc/List/RecordItem.vue
@@ -40,6 +40,8 @@ const { isMobileMode } = useGlobal()
const { getPossibleAttachmentSrc } = useAttachment()
+const { isMounted } = useIsMounted()
+
interface Attachment {
url: string
title: string
@@ -104,7 +106,7 @@ const columnsToRender = computed(() => {
>
<div class="flex items-center gap-3">
<template v-if="attachmentColumn">
- <div v-if="attachments && attachments.length">
+ <div v-if="isMounted && attachments && attachments.length">
<a-carousel autoplay class="!w-11 !h-11 !max-h-11 !max-w-11">
<template #customPaging> </template>
<template v-for="(attachmentObj, index) in attachments">
diff --git a/packages/nc-gui/components/smartsheet/KanbanOptimized.vue b/packages/nc-gui/components/smartsheet/KanbanOptimized.vue
index eaa76c620d..55b22cdf75 100644
--- a/packages/nc-gui/components/smartsheet/KanbanOptimized.vue
+++ b/packages/nc-gui/components/smartsheet/KanbanOptimized.vue
@@ -51,6 +51,8 @@ const { metaColumnById } = useViewColumnsOrThrow(view, meta)
const { isSyncedTable, eventBus } = useSmartsheetStoreOrThrow()
+const { isMounted } = useIsMounted()
+
const {
loadKanbanData,
loadMoreKanbanData,
@@ -1585,7 +1587,7 @@ const resetPointerEvent = (record: RowType, col: ColumnType) => {
could reference a non-existent column. This is a workaround to handle such scenarios properly.
-->
<template v-if="coverImageColumn?.id" #cover>
- <template v-if="!reloadAttachments && attachments(record).length">
+ <template v-if="isMounted && !reloadAttachments && attachments(record).length">
<a-carousel
:key="attachments(record).reduce((acc, curr) => acc + curr?.path, '')"
class="gallery-carousel !border-b-1 !border-nc-border-gray-medium !bg-nc-bg-default"
diff --git a/packages/nc-gui/components/virtual-cell/components/ListItem.vue b/packages/nc-gui/components/virtual-cell/components/ListItem.vue
index 6a065c7c72..c94e717fe6 100644
--- a/packages/nc-gui/components/virtual-cell/components/ListItem.vue
+++ b/packages/nc-gui/components/virtual-cell/components/ListItem.vue
@@ -49,6 +49,8 @@ const readOnly = inject(ReadonlyInj, ref(false))
const { getPossibleAttachmentSrc } = useAttachment()
+const { isMounted } = useIsMounted()
+
interface Attachment {
url: string
title: string
@@ -87,7 +89,7 @@ const attachments: ComputedRef<Attachment[]> = computed(() => {
>
<div class="flex items-center gap-3">
<template v-if="attachment">
- <div v-if="attachments && attachments.length">
+ <div v-if="isMounted && attachments && attachments.length">
<a-carousel autoplay class="!w-11 !h-11 !max-h-11 !max-w-11">
<template #customPaging> </template>
<template v-for="(attachmentObj, index) in attachments">