mirror of
https://github.com/mihonapp/mihon.git
synced 2025-06-26 19:17:51 +02:00
Deduplicate entries when browsing (#1957)
This commit is contained in:
@ -20,6 +20,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
|
||||
|
||||
### Improved
|
||||
- Significantly improve browsing speed (near instantaneous) ([@AntsyLich](https://github.com/AntsyLich)) ([#1946](https://github.com/mihonapp/mihon/pull/1946))
|
||||
- Deduplicate entries when browsing ([@AntsyLich](https://github.com/AntsyLich)) ([#1957](https://github.com/mihonapp/mihon/pull/1957))
|
||||
|
||||
### Fixes
|
||||
- Fix Bangumi search results including novels ([@MajorTanya](https://github.com/MajorTanya)) ([#1885](https://github.com/mihonapp/mihon/pull/1885))
|
||||
|
@ -165,7 +165,9 @@ abstract class SearchScreenModel(
|
||||
source.getSearchManga(1, query, source.getFilterList())
|
||||
}
|
||||
|
||||
val titles = page.mangas.map { it.toDomainManga(source.id) }
|
||||
val titles = page.mangas
|
||||
.map { it.toDomainManga(source.id) }
|
||||
.distinctBy { it.url }
|
||||
.let { networkToLocalManga(it) }
|
||||
|
||||
if (isActive) {
|
||||
|
@ -39,6 +39,8 @@ abstract class BaseSourcePagingSource(
|
||||
private val networkToLocalManga: NetworkToLocalManga = Injekt.get(),
|
||||
) : SourcePagingSource() {
|
||||
|
||||
private val seenManga = hashSetOf<String>()
|
||||
|
||||
abstract suspend fun requestNextPage(currentPage: Int): MangasPage
|
||||
|
||||
override suspend fun load(params: LoadParams<Long>): LoadResult<Long, Manga> {
|
||||
@ -51,7 +53,9 @@ abstract class BaseSourcePagingSource(
|
||||
?: throw NoResultsException()
|
||||
}
|
||||
|
||||
val manga = mangasPage.mangas.map { it.toDomainManga(source.id) }
|
||||
val manga = mangasPage.mangas
|
||||
.map { it.toDomainManga(source.id) }
|
||||
.filter { seenManga.add(it.url) }
|
||||
.let { networkToLocalManga(it) }
|
||||
|
||||
LoadResult.Page(
|
||||
|
Reference in New Issue
Block a user