aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-03-28 08:45:27 +0000
committerFuwn <[email protected]>2026-03-28 08:45:27 +0000
commit59c609aa089248cbb4d4106e9f3c2faa807aed5e (patch)
tree2c9394daa44f47447c5bcad017abc0c8cc7593ae /src/lib
parentfix(anilist): restore completed list filters (diff)
downloaddue.moe-59c609aa089248cbb4d4106e9f3c2faa807aed5e.tar.xz
due.moe-59c609aa089248cbb4d4106e9f3c2faa807aed5e.zip
fix(cache): restore instant filters and shared AniList cache
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Data/AniList/cacheHydration.ts4
-rw-r--r--src/lib/Data/AniList/media.ts2
-rw-r--r--src/lib/List/Anime/CleanAnimeList.svelte18
-rw-r--r--src/lib/List/Manga/CleanMangaList.svelte18
4 files changed, 30 insertions, 12 deletions
diff --git a/src/lib/Data/AniList/cacheHydration.ts b/src/lib/Data/AniList/cacheHydration.ts
index ac3b4d72..434d2a82 100644
--- a/src/lib/Data/AniList/cacheHydration.ts
+++ b/src/lib/Data/AniList/cacheHydration.ts
@@ -6,8 +6,6 @@ import localforage from "localforage";
type MediaCacheKind = "anime" | "manga";
-const cacheStorageKey = (kind: MediaCacheKind) => `${kind}:v2`;
-
interface StoredLastPruneTimes {
anime: number;
chapters: number;
@@ -34,7 +32,7 @@ export const hydrateMediaListCache = (kind: MediaCacheKind) => {
const promise = (async () => {
const [cache, pruneTimes] = await Promise.all([
- localforage.getItem<string>(cacheStorageKey(kind)),
+ localforage.getItem<string>(kind),
localforage.getItem<StoredLastPruneTimes>("lastPruneTimes"),
]);
diff --git a/src/lib/Data/AniList/media.ts b/src/lib/Data/AniList/media.ts
index fee23113..211174e0 100644
--- a/src/lib/Data/AniList/media.ts
+++ b/src/lib/Data/AniList/media.ts
@@ -254,7 +254,7 @@ const usesSharedMediaStore = (options: CollectionOptions) =>
!!options.includeCompleted && !options.all && !options.includeRelations;
const cacheStorageKey = (type: Type, options: CollectionOptions) => {
- const baseKey = type === Type.Anime ? "anime:v2" : "manga:v2";
+ const baseKey = type === Type.Anime ? "anime" : "manga";
if (usesSharedMediaStore(options)) return baseKey;
diff --git a/src/lib/List/Anime/CleanAnimeList.svelte b/src/lib/List/Anime/CleanAnimeList.svelte
index 4bc55772..683e54b4 100644
--- a/src/lib/List/Anime/CleanAnimeList.svelte
+++ b/src/lib/List/Anime/CleanAnimeList.svelte
@@ -71,10 +71,15 @@ let filterKind = upcoming
? "Completed"
: "Due";
const filterKey = `${filterKind}AnimeListFilter`;
+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(
@@ -90,6 +95,11 @@ $: filteredMedia =
? media
: media.filter((m) => m.mediaListEntry?.customLists?.[selectedList]);
+const updateSelectedList = () => {
+ if (!disableFilter && $stateBin[filterKey] !== selectedList)
+ $stateBin[filterKey] = selectedList;
+};
+
const clearAiringRefreshTimeout = () => {
if (airingRefreshTimeout) clearTimeout(airingRefreshTimeout);
@@ -228,7 +238,7 @@ const increment = (anime: Media, progress: number) => {
Force refresh
</button>
{: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}
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}