Simplify series overview page refresh (#1092)
## Description This PR simplifies refreshing the episode data when returning to the series overview page and reduces the number of queries. Also fixes a race condition when refreshing a single item in the an `ApiRequestPager`. ### Related issues Related to #767 ### Testing Emulator, but will need more testing during actual usage ## Screenshots N/A ## AI or LLM usage None
This commit is contained in:
parent
62965c1b22
commit
8bc3384094
3 changed files with 10 additions and 30 deletions
|
|
@ -146,17 +146,17 @@ class ApiRequestPager<T>(
|
|||
position: Int,
|
||||
itemId: UUID,
|
||||
) {
|
||||
val item =
|
||||
api.userLibraryApi.getItem(itemId).content.let {
|
||||
BaseItem.from(
|
||||
it,
|
||||
api,
|
||||
useSeriesForPrimary,
|
||||
)
|
||||
}
|
||||
val pageNumber = position / pageSize
|
||||
val index = position - pageNumber * pageSize
|
||||
mutex.withLock {
|
||||
val item =
|
||||
api.userLibraryApi.getItem(itemId).content.let {
|
||||
BaseItem.from(
|
||||
it,
|
||||
api,
|
||||
useSeriesForPrimary,
|
||||
)
|
||||
}
|
||||
val pageNumber = position / pageSize
|
||||
val index = position - pageNumber * pageSize
|
||||
val page = cachedPages.getIfPresent(pageNumber)
|
||||
if (page != null && index in page.indices) {
|
||||
page[index] = item
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue