diff options
| author | Fuwn <[email protected]> | 2026-05-21 13:44:46 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-05-21 13:44:46 +0000 |
| commit | 08641a3f6f1d95cc8d8dbfeebdecf6c0d2a2b0a6 (patch) | |
| tree | fc75c02f41c3e44c373f53679d561334037cdaec /src/lib/Media | |
| parent | fix(lists): optimistic increment and snapshot to remove refresh flash (diff) | |
| download | due.moe-08641a3f6f1d95cc8d8dbfeebdecf6c0d2a2b0a6.tar.xz due.moe-08641a3f6f1d95cc8d8dbfeebdecf6c0d2a2b0a6.zip | |
feat(debug): add dry-run mutations mode
New 'Dry-run mutations' toggle in the Debug settings panel blocks
outgoing list updates (the + button) and skips the post-mutation
refresh so optimistic UI changes persist locally for testing. The
mutation gate sits in incrementMediaProgress; CleanAnimeList only
revalidates when the request actually went out.
Diffstat (limited to 'src/lib/Media')
| -rw-r--r-- | src/lib/Media/Anime/cache.ts | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/lib/Media/Anime/cache.ts b/src/lib/Media/Anime/cache.ts index e988f255..e1a711ca 100644 --- a/src/lib/Media/Anime/cache.ts +++ b/src/lib/Media/Anime/cache.ts @@ -2,6 +2,7 @@ import { get } from "svelte/store"; import anime from "$stores/anime"; import { mediaListCollection, Type } from "../../Data/AniList/media"; import lastPruneTimes from "$stores/lastPruneTimes"; +import settings from "$stores/settings"; import type { AniListAuthorisation, UserIdentity, @@ -26,8 +27,19 @@ export const incrementMediaProgress = ( id: number, progress: number | undefined, user: AniListAuthorisation, - callback: () => void, + callback: (skipped?: boolean) => void, ) => { + if (get(settings).debugDryRunMutations) { + console.log( + `[dry-run] SaveMediaListEntry(mediaId: ${id}, progress: ${ + (progress || 0) + 1 + }) skipped`, + ); + callback(true); + + return; + } + fetch("https://graphql.anilist.co", { method: "POST", headers: { @@ -40,5 +52,5 @@ export const incrementMediaProgress = ( (progress || 0) + 1 }) { id } }`, }), - }).then(callback); + }).then(() => callback(false)); }; |