aboutsummaryrefslogtreecommitdiff
path: root/src/lib/List
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-08-27 17:22:40 -0700
committerFuwn <[email protected]>2023-08-27 17:22:40 -0700
commit7fc05993446392f5342815734a7a2e99cf63bddb (patch)
treefb14a5ab35b6e4fdbcfb83ec18ad3ca594269134 /src/lib/List
parentfeat(layout): cache user identity (diff)
downloaddue.moe-7fc05993446392f5342815734a7a2e99cf63bddb.tar.xz
due.moe-7fc05993446392f5342815734a7a2e99cf63bddb.zip
feat: cache media
Diffstat (limited to 'src/lib/List')
-rw-r--r--src/lib/List/Due/AnimeList.svelte6
-rw-r--r--src/lib/List/Due/MangaList.svelte22
2 files changed, 15 insertions, 13 deletions
diff --git a/src/lib/List/Due/AnimeList.svelte b/src/lib/List/Due/AnimeList.svelte
index 4580cdf1..8527ed43 100644
--- a/src/lib/List/Due/AnimeList.svelte
+++ b/src/lib/List/Due/AnimeList.svelte
@@ -2,6 +2,8 @@
import { mediaListCollection, Type, flattenLists, type Media } from '$lib/AniList/media';
import type { UserIdentity, AniListAuthorisation } from '$lib/AniList/identity';
import { onMount } from 'svelte';
+ import anime from '../../../stores/anime';
+ import animeLastPrune from '../../../stores/mangaLastPrune';
export let user: AniListAuthorisation;
export let identity: UserIdentity;
@@ -13,7 +15,7 @@
onMount(async () => {
startTime = performance.now();
- animeLists = mediaListCollection(user, identity, Type.Anime);
+ animeLists = mediaListCollection(user, identity, Type.Anime, $anime, $animeLastPrune);
});
const cleanMedia = (media: object[][], displayUnresolved: boolean) => {
@@ -104,7 +106,7 @@
};
const updateMedia = async (id: number, progress: number | undefined) => {
- animeLists = mediaListCollection(user, identity, Type.Anime);
+ animeLists = mediaListCollection(user, identity, Type.Anime, $anime, $animeLastPrune);
await fetch(`/anilist/increment?id=${id}&progress=${progress! + 1}`);
};
diff --git a/src/lib/List/Due/MangaList.svelte b/src/lib/List/Due/MangaList.svelte
index 936d310a..c7f58819 100644
--- a/src/lib/List/Due/MangaList.svelte
+++ b/src/lib/List/Due/MangaList.svelte
@@ -3,8 +3,8 @@
import type { UserIdentity, AniListAuthorisation } from '$lib/AniList/identity';
import { onMount } from 'svelte';
import { chapterCount } from '$lib/mangadex';
- import lastPruneAt from '../../../stores/lastPruneAt';
- import cacheMangaMinutes from '../../../stores/cacheMangaMinutes';
+ import mangaLastPrune from '../../../stores/mangaLastPrune';
+ import manga from '../../../stores/manga';
export let user: AniListAuthorisation;
export let identity: UserIdentity;
@@ -16,7 +16,7 @@
onMount(async () => {
startTime = performance.now();
- mangaLists = mediaListCollection(user, identity, Type.Manga);
+ mangaLists = mediaListCollection(user, identity, Type.Manga, $manga, $mangaLastPrune);
});
const cleanMedia = async (media: object[][], displayUnresolved: boolean) => {
@@ -24,13 +24,13 @@
return [];
}
- if ($lastPruneAt == '') {
- lastPruneAt.set(new Date().getTime().toString());
- } else {
- if ((new Date().getTime() - Number($lastPruneAt)) / 1000 / 60 > Number($cacheMangaMinutes)) {
- lastPruneAt.set(new Date().getTime().toString());
- }
- }
+ // if ($lastPruneAt == '') {
+ // lastPruneAt.set(new Date().getTime().toString());
+ // } else {
+ // if ((new Date().getTime() - Number($lastPruneAt)) / 1000 / 60 > Number($cacheMangaMinutes)) {
+ // lastPruneAt.set(new Date().getTime().toString());
+ // }
+ // }
const flattenedLists = flattenLists(media);
const releasingMedia = flattenedLists.filter(
@@ -76,7 +76,7 @@
};
const updateMedia = async (id: number, progress: number | undefined) => {
- mangaLists = mediaListCollection(user, identity, Type.Manga);
+ mangaLists = mediaListCollection(user, identity, Type.Manga, $manga, $mangaLastPrune);
await fetch(`/anilist/increment?id=${id}&progress=${progress! + 1}`);
};