From e646bbb16e85d21585d12daf76aac95a5c7ffac2 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.net>
Date: Fri, 17 Apr 2026 15:05:11 +0000
Subject: fix(ui): reset media list filter when its custom list disappears

If a user's persisted filter references a custom list that no longer
exists on any media (renamed or deleted on AniList), the select falls
back to showing "All" but the underlying state still filters to an
empty set. Detect the stale value and reset it, clearing the StateBin
entry so the fix survives a reload.
---
 src/lib/List/Anime/CleanAnimeList.svelte | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'src/lib/List/Anime/CleanAnimeList.svelte')

diff --git a/src/lib/List/Anime/CleanAnimeList.svelte b/src/lib/List/Anime/CleanAnimeList.svelte
index e6aa7a5d..064b0fc5 100644
--- a/src/lib/List/Anime/CleanAnimeList.svelte
+++ b/src/lib/List/Anime/CleanAnimeList.svelte
@@ -94,6 +94,16 @@ $: hasDistinguishingList = lists.some((list) =>
 	media.some((m) => !m.mediaListEntry?.customLists?.[list]),
 );
 
+$: if (
+	lists.length > 0 &&
+	selectedList !== "All" &&
+	!lists.includes(selectedList)
+) {
+	selectedList = "All";
+
+	if (!disableFilter) $stateBin[filterKey] = "All";
+}
+
 $: filteredMedia =
 	selectedList === "All" || !$settings.displayMediaListFilter
 		? media
-- 
cgit v1.2.3

