From 1c2a196950553b365cacfdb7cb2974aac41558fe Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Wed, 17 Jan 2024 13:45:30 +0100 Subject: [PATCH] Fix/adding manga to library not updating category (#559) * Refetch categories after updating a manga After adding/removing a manga to/from the library, the categories did not update. * Include manga categories int the manga update mutation response --- src/lib/graphql/mutations/MangaMutation.ts | 18 ++++++++++++++++++ src/lib/requests/RequestManager.ts | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/lib/graphql/mutations/MangaMutation.ts b/src/lib/graphql/mutations/MangaMutation.ts index b9d1ed7c..5d368135 100644 --- a/src/lib/graphql/mutations/MangaMutation.ts +++ b/src/lib/graphql/mutations/MangaMutation.ts @@ -75,6 +75,15 @@ export const UPDATE_MANGA = gql` id inLibrary inLibraryAt + categories { + nodes { + id + mangas { + totalCount + } + } + totalCount + } } } } @@ -88,6 +97,15 @@ export const UPDATE_MANGAS = gql` id inLibrary inLibraryAt + categories { + nodes { + id + mangas { + totalCount + } + } + totalCount + } } } } diff --git a/src/lib/requests/RequestManager.ts b/src/lib/requests/RequestManager.ts index fe42f1de..b916a7fd 100644 --- a/src/lib/requests/RequestManager.ts +++ b/src/lib/requests/RequestManager.ts @@ -1414,7 +1414,8 @@ export class RequestManager { ); result.response.then(() => { - this.graphQLClient.client.cache.evict({ fieldName: 'mangas' }); + this.graphQLClient.client.cache.evict({ broadcast: true, fieldName: 'categories' }); + this.graphQLClient.client.cache.evict({ broadcast: true, fieldName: 'mangas' }); }); return result;