fix: prefer server adjacent books in reader#660
Merged
Conversation
Resolve next and previous book lookups from Komga while online so partial local caches do not skip chapters. Add an explicit end-page helper and comments to document that the previous slot intentionally shows the finished current book.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Reader end pages were resolving adjacent books from SwiftData before consulting Komga. When the local series cache was partial, the next slot could jump to a distant chapter instead of the true next book.
The end page also relies on a non-obvious convention: the leading "previous" slot shows the finished current book because the screen sits between two books.
Approach
Prefer Komga's sibling-book endpoints while online and persist the returned books back into SwiftData. Fall back to cached adjacency only when the app is offline or the network request fails.
Make the end-page convention explicit with a dedicated helper and comments so future changes do not reinterpret the slot semantics.
Scope
BookService.getNextBookandgetPreviousBookto treat only 404 as "no adjacent book"endPagePreviousBook(...)Related
Validation
make build-macos