From e966b0328bbee4bd91bd6f9ea13881bdfd31cbb3 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sat, 23 Dec 2023 15:15:08 +0100 Subject: [PATCH] Remove unnecessary query refetches with mutations (#508) --- src/lib/requests/RequestManager.ts | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/lib/requests/RequestManager.ts b/src/lib/requests/RequestManager.ts index ba6273ab..7307ea07 100644 --- a/src/lib/requests/RequestManager.ts +++ b/src/lib/requests/RequestManager.ts @@ -856,10 +856,7 @@ export class RequestManager { GQLMethod.MUTATION, SET_GLOBAL_METADATA, { input: { meta: { key, value: `${value}` } } }, - { - refetchQueries: [GET_GLOBAL_METADATAS], - ...options, - }, + options, ); result.response.then(() => { @@ -1340,8 +1337,6 @@ export class RequestManager { const wrappedMutate = (mutateOptions: Parameters[0]) => mutate({ onCompleted: () => { - this.graphQLClient.client.cache.evict({ fieldName: 'categories' }); - this.graphQLClient.client.cache.evict({ fieldName: 'category' }); this.graphQLClient.client.cache.evict({ fieldName: 'mangas' }); }, ...mutateOptions, @@ -1363,8 +1358,6 @@ export class RequestManager { ); result.response.then(() => { - this.graphQLClient.client.cache.evict({ fieldName: 'categories' }); - this.graphQLClient.client.cache.evict({ fieldName: 'category' }); this.graphQLClient.client.cache.evict({ fieldName: 'mangas' }); }); @@ -1416,7 +1409,7 @@ export class RequestManager { GQLMethod.MUTATION, GET_MANGA_CHAPTERS_FETCH, { input: { mangaId: Number(mangaId) } }, - { refetchQueries: [GET_MANGA, GET_CHAPTERS], ...options }, + { refetchQueries: [GET_CHAPTERS], ...options }, ); } @@ -1597,7 +1590,7 @@ export class RequestManager { downloadAhead, lastReadChapterIds: downloadAhead ? ids : [], }, - { refetchQueries: [GET_MANGA], ...options }, + options, ); }