From 04c62c2ce3c458d1f8a3e61c45fb08c3c51b109a Mon Sep 17 00:00:00 2001 From: David McNett Date: Sat, 24 Oct 2026 08:12:33 -0500 Subject: [PATCH] Fix classification model card missing cover image when first category is empty (#24768) The cover image only checked the first category returned by the dataset API (after skipping none/unknown) and gave up if it had no images. Since category order follows the dataset directory listing, a model whose first listed category is still empty showed the skeleton placeholder even when other categories had plenty of images. Use the first category that actually has images instead. --- web/src/views/classification/ModelSelectionView.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/web/src/views/classification/ModelSelectionView.tsx b/web/src/views/classification/ModelSelectionView.tsx index 095d5b63a0..5dd5418f12 100644 --- a/web/src/views/classification/ModelSelectionView.tsx +++ b/web/src/views/classification/ModelSelectionView.tsx @@ -271,17 +271,16 @@ function ModelCard({ config, onClick, onUpdate, onDelete }: ModelCardProps) { (key) => key != "none" && key.toLowerCase() != "unknown", ); - if (keys.length === 0) { + const selectedKey = keys.find( + (key) => (dataset.categories[key]?.length ?? 0) > 0, + ); + + if (!selectedKey) { return undefined; } - const selectedKey = keys[0]; const images = dataset.categories[selectedKey]; - if (!images || images.length === 0) { - return undefined; - } - return { name: selectedKey, img: images[0],