Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: unused isLoading
  • Loading branch information
simula-r committed Dec 9, 2025
commit 6bcafbbacf10a0a7bd858e77b18b9daeee8436bd
14 changes: 1 addition & 13 deletions src/renderer/extensions/vueNodes/components/ImagePreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@
ref="currentImageEl"
:src="currentImageUrl"
:alt="imageAltText"
:class="
cn(
'block size-full object-contain pointer-events-none',
isLoading && 'invisible'
)
"
class="block size-full object-contain pointer-events-none"
@load="handleImageLoad"
@error="handleImageError"
/>
Expand Down Expand Up @@ -124,7 +119,6 @@ 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 */
Expand All @@ -147,7 +141,6 @@ const currentIndex = ref(0)
const isHovered = ref(false)
const actualDimensions = ref<string | null>(null)
const imageError = ref(false)
const isLoading = ref(false)
const showLoader = ref(false)

const currentImageEl = ref<HTMLImageElement>()
Expand Down Expand Up @@ -179,7 +172,6 @@ watch(
actualDimensions.value = null

imageError.value = false
isLoading.value = newUrls.length > 0
if (newUrls.length > 0) startDelayedLoader()
},
{ deep: true, immediate: true }
Expand All @@ -191,8 +183,6 @@ const handleImageLoad = (event: Event) => {
const img = event.target
stopDelayedLoader()
showLoader.value = false
isLoading.value = false

imageError.value = false
if (img.naturalWidth && img.naturalHeight) {
actualDimensions.value = `${img.naturalWidth} x ${img.naturalHeight}`
Expand All @@ -202,7 +192,6 @@ const handleImageLoad = (event: Event) => {
const handleImageError = () => {
stopDelayedLoader()
showLoader.value = false
isLoading.value = false
imageError.value = true
actualDimensions.value = null
}
Expand Down Expand Up @@ -245,7 +234,6 @@ const setCurrentIndex = (index: number) => {
if (currentIndex.value === index) return
if (index >= 0 && index < props.imageUrls.length) {
currentIndex.value = index
isLoading.value = true
startDelayedLoader()
imageError.value = false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,6 @@ describe('ImagePreview', () => {
await navigationDots[1].trigger('click')
await nextTick()

// Simulate image load event to clear loading state
const component = wrapper.vm as any
component.isLoading = false
await nextTick()

// Now should show second image
const imgElement = wrapper.find('img')
expect(imgElement.exists()).toBe(true)
Expand Down Expand Up @@ -265,11 +260,6 @@ describe('ImagePreview', () => {
await navigationDots[1].trigger('click')
await nextTick()

// Simulate image load event to clear loading state
const component = wrapper.vm as any
component.isLoading = false
await nextTick()

// Alt text should update
const imgElement = wrapper.find('img')
expect(imgElement.exists()).toBe(true)
Expand Down