From d06a7a9bb689849b2b7beced2606ceb98513f4bb Mon Sep 17 00:00:00 2001 From: Fuwn Date: Wed, 15 Apr 2026 01:18:00 +0000 Subject: feat(cache): instant list revalidation from command palette and debug menu Replaces one-shot boolean revalidateAnime with a counter store so multiple components can subscribe without race conditions. Adds revalidateManga store and reactive refresh blocks to DueAnimeList and MangaListTemplate. Extracts shared invalidateListCaches function used by both the command palette action and the debug settings button. Renames palette item to "Refresh" and debug button to "Invalidate". --- src/lib/Media/invalidate.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/lib/Media/invalidate.ts (limited to 'src/lib/Media') diff --git a/src/lib/Media/invalidate.ts b/src/lib/Media/invalidate.ts new file mode 100644 index 00000000..3a9ff067 --- /dev/null +++ b/src/lib/Media/invalidate.ts @@ -0,0 +1,18 @@ +import { browser } from "$app/environment"; +import { addNotification } from "$lib/Notification/store"; +import { options } from "$lib/Notification/options"; +import revalidateAnime from "$stores/revalidateAnime"; +import revalidateManga from "$stores/revalidateManga"; + +export const invalidateListCaches = () => { + if (!browser) return; + + revalidateAnime.update((n) => n + 1); + revalidateManga.update((n) => n + 1); + + addNotification( + options({ + heading: "Anime and manga list caches successfully invalidated", + }), + ); +}; -- cgit v1.2.3