Skip to content

fix: prefer server adjacent books in reader#660

Merged
everpcpc merged 1 commit intomainfrom
codex/fix-reader-adjacent-books
Mar 14, 2026
Merged

fix: prefer server adjacent books in reader#660
everpcpc merged 1 commit intomainfrom
codex/fix-reader-adjacent-books

Conversation

@everpcpc
Copy link
Copy Markdown
Owner

@everpcpc everpcpc commented Mar 14, 2026

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

  • Restrict BookService.getNextBook and getPreviousBook to treat only 404 as "no adjacent book"
  • Route reader end-page call sites through endPagePreviousBook(...)
  • Keep local adjacency lookup as the offline and error fallback path

Related

Validation

  • make build-macos

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.
@everpcpc everpcpc merged commit 610c310 into main Mar 14, 2026
3 checks passed
@everpcpc everpcpc deleted the codex/fix-reader-adjacent-books branch March 14, 2026 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant