mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
fix: handle image load failures in HeroSection and sanitize IsometricGrid props
HeroSection: track successful loads separately from settled count so failed frames no longer satisfy the ready gate. IsometricGrid: coerce count/columns to finite integers clamped to sane minimums before use in CSS repeat() and v-for. Amp-Thread-ID: https://ampcode.com/threads/T-019d93b8-90d7-71e5-828a-d3bda629468f Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -34,11 +34,13 @@ onMounted(() => {
|
||||
if (!draw) return
|
||||
|
||||
const reducedMotion = prefersReducedMotion()
|
||||
let loadedCount = 0
|
||||
let settledCount = 0
|
||||
let hasSuccessfulFrame = false
|
||||
|
||||
function onFrameReady() {
|
||||
loadedCount++
|
||||
if (loadedCount === FRAME_COUNT) {
|
||||
function onSettled(success: boolean) {
|
||||
if (success) hasSuccessfulFrame = true
|
||||
settledCount++
|
||||
if (settledCount === FRAME_COUNT && hasSuccessfulFrame) {
|
||||
drawFrame(canvas, draw, 0)
|
||||
if (reducedMotion) return
|
||||
const proxy = { frame: 0 }
|
||||
@@ -59,8 +61,8 @@ onMounted(() => {
|
||||
for (let i = 0; i < FRAME_COUNT; i++) {
|
||||
const img = new Image()
|
||||
img.src = `/videos/hero-logo-seq/Logo${String(i).padStart(2, '0')}.webp`
|
||||
img.onload = onFrameReady
|
||||
img.onerror = onFrameReady
|
||||
img.onload = () => onSettled(true)
|
||||
img.onerror = () => onSettled(false)
|
||||
images.push(img)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import { cn } from '@comfyorg/tailwind-utils'
|
||||
|
||||
const { count = 15, columns = 5 } = defineProps<{
|
||||
const { count: rawCount = 15, columns: rawColumns = 5 } = defineProps<{
|
||||
count?: number
|
||||
columns?: number
|
||||
}>()
|
||||
|
||||
const columns = Math.max(1, Math.trunc(Number(rawColumns)) || 1)
|
||||
const count = Math.max(0, Math.trunc(Number(rawCount)) || 0)
|
||||
|
||||
function cellClass(i: number): string {
|
||||
return cn(
|
||||
'block size-5 rounded-sm',
|
||||
|
||||
Reference in New Issue
Block a user