Skip to content

Commit

Permalink
Fix/adding manga to library not updating category (Suwayomi#559)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
schroda authored Jan 17, 2024
1 parent e10cbf9 commit 1c2a196
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/lib/graphql/mutations/MangaMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ export const UPDATE_MANGA = gql`
id
inLibrary
inLibraryAt
categories {
nodes {
id
mangas {
totalCount
}
}
totalCount
}
}
}
}
Expand All @@ -88,6 +97,15 @@ export const UPDATE_MANGAS = gql`
id
inLibrary
inLibraryAt
categories {
nodes {
id
mangas {
totalCount
}
}
totalCount
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/lib/requests/RequestManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1c2a196

Please sign in to comment.