Skip to content

Commit

Permalink
Merge pull request #175 from Suwayomi/main
Browse files Browse the repository at this point in the history
latestReadChapter > lastReadChapter
  • Loading branch information
Robonau authored Mar 12, 2024
2 parents 9be5432 + cdf5484 commit e4cfd48
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 155 deletions.
3 changes: 0 additions & 3 deletions src/gql/Fragments.gql
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ fragment MangaTypeFragment on MangaType {
latestUploadedChapter {
uploadDate
}
latestReadChapter {
lastReadAt
}
lastReadChapter {
lastReadAt
}
Expand Down
2 changes: 1 addition & 1 deletion src/gql/Queries.gql
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ query category($id: Int!) {
latestUploadedChapter {
uploadDate
}
latestReadChapter {
lastReadChapter {
lastReadAt
}
chapters {
Expand Down
4 changes: 0 additions & 4 deletions src/lib/gql/Fragments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ export const MangaTypeFragment = graphql(
uploadDate
id
}
latestReadChapter {
lastReadAt
id
}
lastReadChapter {
lastReadAt
id
Expand Down
2 changes: 1 addition & 1 deletion src/lib/gql/Mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const updateMangas = graphql(
uploadDate
id
}
latestReadChapter {
lastReadChapter {
lastReadAt
id
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/gql/Queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const getCategory = graphql(
uploadDate
id
}
latestReadChapter {
lastReadChapter {
lastReadAt
id
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/gql/graphqlClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ function updateMangaCategoriesUpdater(
unreadCount: dat.manga.unreadCount ?? 0,
downloadCount: dat.manga.downloadCount ?? 0,
latestFetchedChapter: dat.manga.latestFetchedChapter,
latestReadChapter: dat.manga.latestReadChapter,
lastReadChapter: dat.manga.lastReadChapter,
latestUploadedChapter: dat.manga.latestUploadedChapter,
trackRecords: dat.manga.trackRecords,
chapters: dat.manga.chapters ?? {
Expand Down
4 changes: 2 additions & 2 deletions src/routes/(app)/(library)/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@
break;
case sort['Latest Read']:
tru =
parseInt(a.latestReadChapter?.lastReadAt ?? '0') >
parseInt(b.latestReadChapter?.lastReadAt ?? '0');
parseInt(a.lastReadChapter?.lastReadAt ?? '0') >
parseInt(b.lastReadChapter?.lastReadAt ?? '0');
break;
case sort['Latest Fetched']:
tru =
Expand Down
141 changes: 0 additions & 141 deletions src/routes/(app)/manga/[MangaID]/(manga)/MangaCatagoryModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -45,139 +45,6 @@
);
}
// function updateMangaCategoriesUpdate(
// cache: ApolloCache<unknown>,
// { data }: Omit<FetchResult<UpdateMangaCategoriesMutation>, 'context'>
// ): void {
// if (!data?.updateMangaCategories.manga.categories.nodes) return;
// const nodes = data.updateMangaCategories.manga.categories.nodes;
// const errors: Error[] = [];
// //// update this mangas categories
// try {
// const magna = structuredClone(manga);
// magna.categories.nodes = nodes;
// cache.writeQuery({
// query: GetMangaDoc,
// variables: { id: manga.id },
// data: { manga: magna }
// });
// } catch (e) {
// if (e instanceof Error) errors.push(e);
// }
// //// update the categories in library
// try {
// const oldNodes = manga.categories.nodes;
// if (!oldNodes) return;
// try {
// const currentManga: CategoryQuery['category']['mangas']['nodes'][0] = {
// id: manga.id,
// title: manga.title,
// inLibrary: manga.inLibrary,
// thumbnailUrl: manga.thumbnailUrl,
// unreadCount: manga.unreadCount,
// downloadCount: manga.downloadCount,
// latestFetchedChapter: manga.latestFetchedChapter,
// latestReadChapter: manga.latestReadChapter,
// latestUploadedChapter: manga.latestUploadedChapter,
// chapters: manga.chapters
// };
// // add to categories that now have it
// nodes.forEach((newNode) => {
// if (oldNodes.find((oldNode) => oldNode.id === newNode.id)) return;
// try {
// const categoryData = structuredClone(
// cache.readQuery<CategoryQuery>({
// query: CategoryDoc,
// variables: { id: newNode.id }
// })
// );
// if (!categoryData) return;
// categoryData.category.mangas.nodes.push(currentManga);
// cache.writeQuery({
// query: CategoryDoc,
// variables: { id: newNode.id },
// data: categoryData
// });
// } catch {}
// });
// // add to 0 if now in default
// if (nodes.length === 0 && oldNodes.length > 0) {
// try {
// const categoryData = structuredClone(
// cache.readQuery<CategoryQuery>({
// query: CategoryDoc,
// variables: { id: 0 }
// })
// );
// if (!categoryData) return;
// categoryData.category.mangas.nodes.push(currentManga);
// cache.writeQuery({
// query: CategoryDoc,
// variables: { id: 0 },
// data: categoryData
// });
// } catch {}
// }
// } catch {}
// //remove from categories that no longer have it
// oldNodes.forEach((oldNode) => {
// if (nodes.find((newNode) => oldNode.id === newNode.id)) return;
// try {
// const categoryData = structuredClone(
// cache.readQuery<CategoryQuery>({
// query: CategoryDoc,
// variables: { id: oldNode.id }
// })
// );
// if (!categoryData) return;
// categoryData.category.mangas.nodes = categoryData.category.mangas.nodes.filter(
// (e) => e.id !== manga.id
// );
// cache.writeQuery({
// query: CategoryDoc,
// variables: { id: oldNode.id },
// data: categoryData
// });
// } catch {}
// });
// // remove from 0 if no longer in default
// if (oldNodes.length === 0 && nodes.length > 0) {
// //remove from default
// try {
// const categoryData = structuredClone(
// cache.readQuery<CategoryQuery>({
// query: CategoryDoc,
// variables: { id: 0 }
// })
// );
// if (!categoryData) return;
// categoryData.category.mangas.nodes = categoryData.category.mangas.nodes.filter(
// (e) => e.id !== manga.id
// );
// cache.writeQuery({
// query: CategoryDoc,
// variables: { id: 0 },
// data: categoryData
// });
// } catch {}
// }
// } catch {}
// if (errors.length > 0) {
// console.error(errors);
// throw new Error('check console');
// }
// }
async function handelSubmit() {
modalStore.close();
if (
Expand All @@ -193,14 +60,6 @@
clear: true
})
.toPromise()
// updateMangaCategories({
// variables: {
// id: manga.id,
// addTo: selectedCategories,
// clear: true
// },
// update: updateMangaCategoriesUpdate
// })
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion versionToServerVersionMapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
{
"tag": "v1.0.0",
"uiVersion": "r592",
"uiVersion": "r595",
"serverVersion": "r1498"
}
]

0 comments on commit e4cfd48

Please sign in to comment.