fix: Apply active filters to chapter count display (Closes #1793) - #1797
Merged
Conversation
) getChapterCount was always returning the total count regardless of the active filter. When filtering by unread/downloaded/bookmarked, the count shown in the novel header stayed the same as the total. Added an optional filter parameter to getChapterCount and pass the current settingsFilter from useNovel so the displayed count matches the filtered chapter list.
5 tasks
Collaborator
|
Please fix the lint warnings in useNovel and tests for the filter behavior. |
CD-Z
self-requested a review
March 25, 2026 12:18
- Use settingsFilter instead of novelSettings.filter in useNovel to fix the react-hooks/exhaustive-deps warning - Add tests for getChapterCount with filter parameter - Update chapterFilterToSQL mock in test setup to actually apply filter conditions so filtered count tests work correctly
Contributor
Author
|
Fixed in e05a70b:
All 201 tests passing. |
rajarsheechatterjee
approved these changes
Mar 30, 2026
CD-Z
approved these changes
Apr 13, 2026
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.
Fixes #1793
When filtering chapters (e.g. showing only unread), the chapter count in the novel header kept showing the total instead of the filtered count.
Root cause:
getChapterCountinChapterQueries.tsonly acceptednovelIdandpage, with no way to pass the active filter. MeanwhilegetPageChaptersBatched(which fetches the actual chapter list) was correctly applying filters viachapterFilterToSQL.What changed:
filterparameter togetChapterCountand appliedchapterFilterToSQLin the count queryuseNovel.tsto pass the currentsettingsFilterThe reader's
useChapter.tsalso callsgetChapterCount(to check if a next/prev page has chapters), but those calls intentionally stay unfiltered since the reader should still allow navigating across all chapters.Testing: