fix seed job leak and viewport fill top padding

This commit is contained in:
austinried
2026-10-04 00:29:53 +00:00
parent 9c1ba2bea6
commit eb6383115e
2 changed files with 6 additions and 5 deletions
@@ -23,7 +23,8 @@ fun rememberViewportFill(state: LazyListState): Dp {
FILL_EPSILON_PX
} else {
val contentBottom = visibleReal.maxOf { it.offset + it.size }
(info.viewportSize.height - info.afterContentPadding - contentBottom).coerceAtLeast(0) + FILL_EPSILON_PX
val padding = info.beforeContentPadding + info.afterContentPadding
(info.viewportSize.height - padding - contentBottom).coerceAtLeast(0) + FILL_EPSILON_PX
}
}
}
@@ -42,7 +43,8 @@ fun rememberViewportFill(state: LazyGridState): Dp {
FILL_EPSILON_PX
} else {
val contentBottom = visibleReal.maxOf { it.offset.y + it.size.height }
(info.viewportSize.height - info.afterContentPadding - contentBottom).coerceAtLeast(0) + FILL_EPSILON_PX
val padding = info.beforeContentPadding + info.afterContentPadding
(info.viewportSize.height - padding - contentBottom).coerceAtLeast(0) + FILL_EPSILON_PX
}
}
}
@@ -50,9 +50,8 @@ object ArtworkSeedCache {
): Pair<Int, Int?>? {
cache.get(ref.cacheKey)?.let { return it }
val job = jobs.computeIfAbsent(ref.cacheKey) { scope.async { resolve(context, ref) } }
val seeds = job.await()
jobs.remove(ref.cacheKey, job)
return seeds
job.invokeOnCompletion { jobs.remove(ref.cacheKey, job) }
return job.await()
}
fun prefetch(