Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: show the video placeholder when a download thumbnail fails to load (#10421)

Adam Eivy08306e2ba98e
diff --git a/client/src/pages/VideoDownloaderPage.jsx b/client/src/pages/VideoDownloaderPage.jsx
index 33fe4580c7..7da0e397a6 100644
--- a/client/src/pages/VideoDownloaderPage.jsx
+++ b/client/src/pages/VideoDownloaderPage.jsx
@@ -16,6 +16,8 @@ export default function VideoDownloaderPage() {
const [downloads, setDownloads] = useState([]);
const [loading, setLoading] = useState(true);
const [deletingId, setDeletingId] = useState(null);
+ // Thumbnail filenames that failed to load; keyed by value so a new thumbnail retries.
+ const [failedThumbs, setFailedThumbs] = useState(() => new Set());
const { isConfirming, requestDelete, cancelDelete, confirmDelete } = useConfirmDelete();
useEffect(() => {
@@ -127,11 +129,12 @@ export default function VideoDownloaderPage() {
rel="noreferrer"
className="shrink-0 block w-28 aspect-video rounded overflow-hidden bg-port-bg border border-port-border"
>
- {d.thumbnail ? (
+ {d.thumbnail && !failedThumbs.has(d.thumbnail) ? (
<img
src={`/data/video-thumbnails/${d.thumbnail}`}
alt=""
className="w-full h-full object-cover"
+ onError={() => setFailedThumbs((prev) => new Set(prev).add(d.thumbnail))}
/>
) : (
<span className="w-full h-full flex items-center justify-center text-gray-600">
diff --git a/client/src/pages/VideoDownloaderPage.test.jsx b/client/src/pages/VideoDownloaderPage.test.jsx
new file mode 100644
index 0000000000..55014c724d
--- /dev/null
+++ b/client/src/pages/VideoDownloaderPage.test.jsx
@@ -0,0 +1,34 @@
+import { describe, it, expect, vi } from 'vitest';
+import { render, screen, fireEvent, waitFor, within } from '@testing-library/react';
+
+vi.mock('../services/apiVideoDownload.js', () => ({
+ listVideoDownloads: vi.fn().mockResolvedValue([
+ { id: 'a', filename: 'a.mp4', thumbnail: 'a.jpg', title: 'Clip A', createdAt: new Date().toISOString() },
+ { id: 'b', filename: 'b.mp4', thumbnail: 'b.jpg', title: 'Clip B', createdAt: new Date().toISOString() },
+ ]),
+ deleteVideoDownload: vi.fn(),
+}));
+vi.mock('../hooks', () => ({
+ useVideoDownload: () => ({ active: false, percent: 0, stage: '', start: vi.fn(), cancel: vi.fn() }),
+ useConfirmDelete: () => ({ isConfirming: () => false, requestDelete: vi.fn(), cancelDelete: vi.fn(), confirmDelete: vi.fn() }),
+}));
+vi.mock('../components/video/YtDlpUpdateCard', () => ({ default: () => null }));
+vi.mock('../components/ui/Toast', () => ({ default: { error: vi.fn(), success: vi.fn() } }));
+
+import VideoDownloaderPage from './VideoDownloaderPage';
+
+describe('VideoDownloaderPage thumbnails', () => {
+ it('swaps only the failed thumbnail for the placeholder', async () => {
+ const { container } = render(<VideoDownloaderPage />);
+ await waitFor(() => expect(container.querySelectorAll('img').length).toBe(2));
+ const rows = screen.getAllByRole('listitem');
+ const rowA = within(rows[0]);
+ const imgA = rows[0].querySelector('img');
+ expect(rows[0].querySelector('svg.lucide-video')).toBeNull();
+ fireEvent.error(imgA);
+ expect(rows[0].querySelector('img')).toBeNull();
+ expect(rows[0].querySelector('svg.lucide-video')).not.toBeNull();
+ expect(rows[1].querySelector('img')).not.toBeNull();
+ expect(rowA.getByText('Clip A')).toBeTruthy();
+ });
+});