Fixed favorites not refreshing when removing entries

Fixed favorites not refreshing when removing entries while in favorites view. Previously, removed items would only disappear after switching to regular view and back. The favorites list now updates immediately upon removal
This commit is contained in:
jp64k
2026-01-30 04:07:30 +01:00
parent 61e6c143fa
commit 50b52d963b

View File

@@ -6541,6 +6541,29 @@ function onYouTubeIframeAPIReady() {
settings.AddFavoriteGame(packageName);
UpdateFavoriteMenuItemText();
// If currently viewing favorites, refresh the list to reflect the change
bool isViewingFavorites = favoriteSwitcher.Text == "ALL";
if (isViewingFavorites)
{
var favSet = new HashSet<string>(settings.FavoritedGames, StringComparer.OrdinalIgnoreCase);
var favoriteItems = _allItems
.Where(item => item.SubItems.Count > 1 && favSet.Contains(item.SubItems[1].Text))
.ToList();
gamesListView.BeginUpdate();
gamesListView.Items.Clear();
gamesListView.Items.AddRange(favoriteItems.ToArray());
gamesListView.EndUpdate();
_galleryDataSource = favoriteItems;
if (isGalleryView && _fastGallery != null)
{
_fastGallery.RefreshFavoritesCache();
_fastGallery.UpdateItems(favoriteItems);
}
}
}
private void UpdateFavoriteMenuItemText()