Remove unnecessary query refetches with mutations (#508)

This commit is contained in:
schroda
2023-12-23 15:15:08 +01:00
committed by GitHub
parent 3756b65256
commit e966b0328b

View File

@@ -856,10 +856,7 @@ export class RequestManager {
GQLMethod.MUTATION, GQLMethod.MUTATION,
SET_GLOBAL_METADATA, SET_GLOBAL_METADATA,
{ input: { meta: { key, value: `${value}` } } }, { input: { meta: { key, value: `${value}` } } },
{ options,
refetchQueries: [GET_GLOBAL_METADATAS],
...options,
},
); );
result.response.then(() => { result.response.then(() => {
@@ -1340,8 +1337,6 @@ export class RequestManager {
const wrappedMutate = (mutateOptions: Parameters<typeof mutate>[0]) => const wrappedMutate = (mutateOptions: Parameters<typeof mutate>[0]) =>
mutate({ mutate({
onCompleted: () => { onCompleted: () => {
this.graphQLClient.client.cache.evict({ fieldName: 'categories' });
this.graphQLClient.client.cache.evict({ fieldName: 'category' });
this.graphQLClient.client.cache.evict({ fieldName: 'mangas' }); this.graphQLClient.client.cache.evict({ fieldName: 'mangas' });
}, },
...mutateOptions, ...mutateOptions,
@@ -1363,8 +1358,6 @@ export class RequestManager {
); );
result.response.then(() => { result.response.then(() => {
this.graphQLClient.client.cache.evict({ fieldName: 'categories' });
this.graphQLClient.client.cache.evict({ fieldName: 'category' });
this.graphQLClient.client.cache.evict({ fieldName: 'mangas' }); this.graphQLClient.client.cache.evict({ fieldName: 'mangas' });
}); });
@@ -1416,7 +1409,7 @@ export class RequestManager {
GQLMethod.MUTATION, GQLMethod.MUTATION,
GET_MANGA_CHAPTERS_FETCH, GET_MANGA_CHAPTERS_FETCH,
{ input: { mangaId: Number(mangaId) } }, { input: { mangaId: Number(mangaId) } },
{ refetchQueries: [GET_MANGA, GET_CHAPTERS], ...options }, { refetchQueries: [GET_CHAPTERS], ...options },
); );
} }
@@ -1597,7 +1590,7 @@ export class RequestManager {
downloadAhead, downloadAhead,
lastReadChapterIds: downloadAhead ? ids : [], lastReadChapterIds: downloadAhead ? ids : [],
}, },
{ refetchQueries: [GET_MANGA], ...options }, options,
); );
} }