Open Kashifmasood07 opened 1 year ago
Hi, thanks for use. which cache configure to cause ui to lag, can you provide a demo to help me analyse it?
fun ReviewSection(
onImageClick: (List<MediaDomainModel>, Int) -> Unit,
onProductImageClick: (List<MediaDomainModel>) -> Unit,
onProductInfoClick: (Int) -> Unit,
) = ComposeUIViewController {
CompositionLocalProvider(
LocalImageLoader provides remember { generateImageLoader() }
) {
MarkazSupplierAppTheme() {
ReviewSectionScreen(
onImageClick = onImageClick,
onProductImageClick = onProductImageClick,
onProductInfoClick = onProductInfoClick
)
}
}
}
fun generateImageLoader(): ImageLoader {
return ImageLoader {
components {
setupDefaultComponents()
}
interceptor {
diskCacheConfig {
directory(getCacheDir().toPath().resolve("image_cache"))
}
}
}
}
fun getCacheDir(): String {
return NSSearchPathForDirectoriesInDomains(
NSCachesDirectory,
NSUserDomainMask,
true,
).first() as String
}
That is how I'm configuring caching. And it lags when I scroll through the lazy list, if i remove the caching it works fine.
It works fine normally but when I enabled Image caching as mentioned in the documentation, ui starts to lag a lot while scroll through the lazylists.