fix(collections): preserve catalog genre filter on View All#1293
Open
DynamycSound wants to merge 1 commit into
Open
fix(collections): preserve catalog genre filter on View All#1293DynamycSound wants to merge 1 commit into
DynamycSound wants to merge 1 commit into
Conversation
The genre filter applied to a collection folder catalog was dropped when opening View All. FolderDetailRepository.getCatalogSectionsForRows() built HomeCatalogSection without carrying the tab's genre, and onCatalogClick did not forward it to CatalogRoute, so the full-catalog screen loaded unfiltered. Add a genre field to HomeCatalogSection, pass tab.genre when mapping folder tabs to sections, and forward section.genre into CatalogRoute so the selected genre filter is preserved through View All. Fixes NuvioMedia#1264
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.
Summary
When a collection folder catalog has a genre filter applied (for example, a "Movies" catalog filtered to Romance), tapping View All dropped the genre and loaded the entire unfiltered catalog. This PR carries the active genre through the View All navigation so the full-catalog screen stays filtered to the same genre that was shown in the folder row.
Why
The folder row sections are built from
FolderTabs, which already hold the selectedgenre. However:FolderDetailRepository.getCatalogSectionsForRows()mapped eachFolderTabto aHomeCatalogSection, butHomeCatalogSectionhad nogenrefield, so the genre was silently dropped at that point.onCatalogClick(inApp.kt) built aCatalogRoutefrom the section without settinggenre, even thoughCatalogRoute/CatalogScreenalready support agenreparameter that is forwarded all the way toCatalogRepository.fetchCatalogPage(genre = ...).Because the genre never reached
CatalogRoute,CatalogScreenwas opened withgenre = nulland requested the catalog unfiltered.The fix preserves the existing genre value through that single broken link in the chain. No filtering logic is added or changed — it already existed end-to-end; it was just being lost during the folder → View All transition.
Issue or approval
Fixes #1264
UI / behavior impact
Policy check
PR type
Scope boundaries
Three files changed, one line each, no formatting or unrelated edits:
composeApp/src/commonMain/kotlin/com/nuvio/app/features/home/HomeModels.kt— addval genre: String? = nulltoHomeCatalogSection(defaulted, so all existing construction sites are unaffected).composeApp/src/commonMain/kotlin/com/nuvio/app/features/collection/FolderDetailRepository.kt— passgenre = tab.genrewhen mapping aFolderTabto aHomeCatalogSectioningetCatalogSectionsForRows().composeApp/src/commonMain/kotlin/com/nuvio/app/App.kt— forwardgenre = section.genreintoCatalogRouteinsideonCatalogClick.Testing
Build
Unit tests
The 4 failing tests are pre-existing and unrelated to this change. They fail identically on a clean
cmp-rewritecheckout (verified by stashing this change and re-running the same tasks):LibraryRepositoryTest(×2) —Method getSystem in android.content.res.Resources not mocked(JVM unit-test environment limitation).StreamAutoPlaySelectorTest(×2) — timeout/debrid candidate timing assertions.None of them touch the catalog, collection, or navigation code paths modified here.
Static analysis (the affected path runs through Compose navigation + singleton repository state, so it is not cleanly unit-testable without an unrelated refactor):
FolderTab.genre→ dropped atgetCatalogSectionsForRows()→CatalogRoute.genre = null→CatalogScreen(genre = null)→fetchCatalogPage(genre = null)→ unfiltered catalog.FolderTab.genre→HomeCatalogSection.genre→CatalogRoute.genre→CatalogScreen(genre = <selected>)→fetchCatalogPage(genre = <selected>)→ catalog stays filtered to the selected genre.genre = null, identical to current behavior. Home and search sections never set a genre, so they remain unfiltered exactly as before.null, so no existingHomeCatalogSectionconstruction site (home, search) changes behavior; only the folder View All path, which is the bug, is affected.Screenshots / Video
Not a UI change.
Breaking changes
None.
Linked issues
Fixes #1264