diff options
Diffstat (limited to 'src/lib/List/Manga/CleanMangaList.svelte')
| -rw-r--r-- | src/lib/List/Manga/CleanMangaList.svelte | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/lib/List/Manga/CleanMangaList.svelte b/src/lib/List/Manga/CleanMangaList.svelte index db5778da..9727c26d 100644 --- a/src/lib/List/Manga/CleanMangaList.svelte +++ b/src/lib/List/Manga/CleanMangaList.svelte @@ -50,10 +50,15 @@ let totalEpisodeDueCount = media let lists: string[] = []; const filterKind = due ? "due" : "completed"; const filterKey = `${filterKind}MangaListFilter`; +let selectedList = "All"; -$: selectedList = disableFilter - ? "All" - : ($stateBin[filterKey] as string) || "All"; +$: { + const persistedList = disableFilter + ? "All" + : ($stateBin[filterKey] as string) || "All"; + + if (persistedList !== selectedList) selectedList = persistedList; +} $: lists = Array.from( new Set( @@ -69,6 +74,11 @@ $: filteredMedia = ? media : media.filter((m) => m.mediaListEntry?.customLists?.[selectedList]); +const updateSelectedList = () => { + if (!disableFilter && $stateBin[filterKey] !== selectedList) + $stateBin[filterKey] = selectedList; +}; + onMount(async () => { serviceStatusResponse = fetch(proxy("https://api.mangadex.org/ping")); @@ -159,7 +169,7 @@ const increment = (manga: Media) => { You can re-enable it later in the <a href={root('/settings')}>Settings</a>. </span> {:else if $settings.displayMediaListFilter && !disableFilter} - <select bind:value={$stateBin[filterKey]}> + <select bind:value={selectedList} onchange={updateSelectedList}> <option value="All">All</option> {#each lists as list} |