From 31751579a319da3fcb4dfcc14a1f69c73e0775a7 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 25 Jan 2026 17:44:21 +0000 Subject: [PATCH] Fix: prevent thumbnail cache from being cleared on empty video lists This commit addresses an issue where thumbnail images would "drop" (disappear/flicker) upon login or re-initialization of the video list. Changes: - Modified `js/ui/views/VideoListView.js` to add a guard clause in `cleanupThumbnailCache`. - The function now returns early if the provided `videos` list is empty, preserving the existing `loadedThumbnails` cache during transient loading states. Verification: - Created a reproduction script (`reproduce_issue.mjs`) that confirmed the cache was being cleared on empty input. - Verified the fix with the same script, ensuring the cache is preserved. - Verified no regression in `npm run lint:hex` and `npm run lint:inline-styles`. --- js/ui/views/VideoListView.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/ui/views/VideoListView.js b/js/ui/views/VideoListView.js index 51871bc9..f8cf031e 100644 --- a/js/ui/views/VideoListView.js +++ b/js/ui/views/VideoListView.js @@ -1011,6 +1011,10 @@ export class VideoListView { return; } + if (!Array.isArray(videos) || videos.length === 0) { + return; + } + const activeIds = new Set(); videos.forEach((video) => { if (video && typeof video.id === "string" && video.id) {