Feature/gql improve queries mutations subscriptions (#470)
* [Codegen] Request less fields for category mutations * [Codegen] Request less fields for chapter mutations * [Codegen] Request less fields for downloader mutations * [Codegen] Request less fields for extension mutations * [Codegen] Request less fields for manga mutations * [Codegen] Request less fields for source mutations * [Codegen] Request less fields for updater subscription * [Codegen] Request less fields for downloader subscription * [Codegen] Combine chapter update mutations
This commit is contained in:
@@ -125,7 +125,6 @@ export function Reader() {
|
||||
|
||||
const { data: settingsData } = requestManager.useGetServerSettings();
|
||||
const isDownloadAheadEnabled = !!settingsData?.settings.autoDownloadAheadLimit;
|
||||
const [downloadAhead] = requestManager.useDownloadAhead();
|
||||
|
||||
const getLoadedChapter = () => {
|
||||
const isAChapterLoaded = loadedChapter.current;
|
||||
@@ -177,29 +176,22 @@ export function Reader() {
|
||||
const { settings: metadataSettings } = useMetadataServerSettings();
|
||||
|
||||
const updateChapter = (patch: UpdateChapterPatchInput) => {
|
||||
requestManager.updateChapter(chapter.id, patch).response.catch(() => {});
|
||||
|
||||
const shouldDeleteChapter =
|
||||
patch.isRead &&
|
||||
!!patch.isRead &&
|
||||
metadataSettings.deleteChaptersAutoMarkedRead &&
|
||||
chapter.isDownloaded &&
|
||||
(!chapter.isBookmarked || metadataSettings.deleteChaptersWithBookmark);
|
||||
if (shouldDeleteChapter) {
|
||||
requestManager.deleteDownloadedChapter(chapter.id).response.catch(() => {});
|
||||
}
|
||||
|
||||
const shouldDownloadAhead =
|
||||
chapter.manga.inLibrary && !chapter.isRead && patch.isRead && isDownloadAheadEnabled;
|
||||
if (shouldDownloadAhead) {
|
||||
downloadAhead({
|
||||
variables: {
|
||||
input: {
|
||||
mangaIds: [chapter.manga.id],
|
||||
latestReadChapterIds: [chapter.id],
|
||||
},
|
||||
},
|
||||
}).catch(() => {});
|
||||
}
|
||||
chapter.manga.inLibrary && !chapter.isRead && !!patch.isRead && isDownloadAheadEnabled;
|
||||
|
||||
requestManager
|
||||
.updateChapter(chapter.id, {
|
||||
...patch,
|
||||
deleteChapter: shouldDeleteChapter,
|
||||
downloadAheadMangaId: shouldDownloadAhead ? chapter.manga.id : undefined,
|
||||
})
|
||||
.response.catch(() => {});
|
||||
};
|
||||
|
||||
const setSettingValue = (key: keyof IReaderSettings, value: string | boolean) => {
|
||||
|
||||
Reference in New Issue
Block a user