mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-02 14:27:40 +00:00
[backport core/1.33] Fix skeleton loaders for Image/Video Previews (#7248)
Backport of #7094 to `core/1.33` Automatically created by backport workflow. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7248-backport-core-1-33-Fix-skeleton-loaders-for-Image-Video-Previews-2c36d73d3650814c9187f6321af27b96) by [Unito](https://www.unito.io) Co-authored-by: Johnpaul Chiwetelu <49923152+Myestery@users.noreply.github.com>
This commit is contained in:
@@ -26,13 +26,19 @@
|
||||
</div>
|
||||
|
||||
<!-- Loading State -->
|
||||
<Skeleton v-else-if="isLoading" class="size-full" border-radius="5px" />
|
||||
<Skeleton
|
||||
v-if="isLoading && !videoError"
|
||||
class="absolute inset-0 size-full"
|
||||
border-radius="5px"
|
||||
width="16rem"
|
||||
height="16rem"
|
||||
/>
|
||||
|
||||
<!-- Main Video -->
|
||||
<video
|
||||
v-else
|
||||
v-if="!videoError"
|
||||
:src="currentVideoUrl"
|
||||
class="block size-full object-contain"
|
||||
:class="cn('block size-full object-contain', isLoading && 'invisible')"
|
||||
controls
|
||||
loop
|
||||
playsinline
|
||||
@@ -106,6 +112,7 @@ import { useI18n } from 'vue-i18n'
|
||||
|
||||
import { downloadFile } from '@/base/common/downloadUtil'
|
||||
import { useNodeOutputStore } from '@/stores/imagePreviewStore'
|
||||
import { cn } from '@/utils/tailwindUtil'
|
||||
|
||||
interface VideoPreviewProps {
|
||||
/** Array of video URLs to display */
|
||||
@@ -142,7 +149,7 @@ watch(
|
||||
// Reset loading and error states when URLs change
|
||||
actualDimensions.value = null
|
||||
videoError.value = false
|
||||
isLoading.value = false
|
||||
isLoading.value = newUrls.length > 0
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
@@ -26,15 +26,26 @@
|
||||
</div>
|
||||
|
||||
<!-- Loading State -->
|
||||
<Skeleton v-else-if="isLoading" class="size-full" border-radius="5px" />
|
||||
<Skeleton
|
||||
v-if="isLoading && !imageError"
|
||||
class="absolute inset-0 size-full"
|
||||
border-radius="5px"
|
||||
width="16rem"
|
||||
height="16rem"
|
||||
/>
|
||||
|
||||
<!-- Main Image -->
|
||||
<img
|
||||
v-else
|
||||
v-if="!imageError"
|
||||
ref="currentImageEl"
|
||||
:src="currentImageUrl"
|
||||
:alt="imageAltText"
|
||||
class="block size-full object-contain pointer-events-none"
|
||||
:class="
|
||||
cn(
|
||||
'block size-full object-contain pointer-events-none',
|
||||
isLoading && 'invisible'
|
||||
)
|
||||
"
|
||||
@load="handleImageLoad"
|
||||
@error="handleImageError"
|
||||
/>
|
||||
@@ -118,6 +129,7 @@ import { downloadFile } from '@/base/common/downloadUtil'
|
||||
import { app } from '@/scripts/app'
|
||||
import { useCommandStore } from '@/stores/commandStore'
|
||||
import { useNodeOutputStore } from '@/stores/imagePreviewStore'
|
||||
import { cn } from '@/utils/tailwindUtil'
|
||||
|
||||
interface ImagePreviewProps {
|
||||
/** Array of image URLs to display */
|
||||
@@ -161,7 +173,7 @@ watch(
|
||||
// Reset loading and error states when URLs change
|
||||
actualDimensions.value = null
|
||||
imageError.value = false
|
||||
isLoading.value = false
|
||||
isLoading.value = newUrls.length > 0
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
@@ -221,7 +233,7 @@ const setCurrentIndex = (index: number) => {
|
||||
if (index >= 0 && index < props.imageUrls.length) {
|
||||
currentIndex.value = index
|
||||
actualDimensions.value = null
|
||||
isLoading.value = false
|
||||
isLoading.value = true
|
||||
imageError.value = false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user