Skip to content

Commit

Permalink
Remove unnecessary query refetches with mutations (#508)
Browse files Browse the repository at this point in the history
  • Loading branch information
schroda authored Dec 23, 2023
1 parent 3756b65 commit e966b03
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/lib/requests/RequestManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down Expand Up @@ -1340,8 +1337,6 @@ export class RequestManager {
const wrappedMutate = (mutateOptions: Parameters<typeof mutate>[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,
Expand All @@ -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' });
});

Expand Down Expand Up @@ -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 },
);
}

Expand Down Expand Up @@ -1597,7 +1590,7 @@ export class RequestManager {
downloadAhead,
lastReadChapterIds: downloadAhead ? ids : [],
},
{ refetchQueries: [GET_MANGA], ...options },
options,
);
}

Expand Down

0 comments on commit e966b03

Please sign in to comment.