You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a case where we may get a bad URL as input, and the image will fail to load. In this case, upon every recomposition GlideImage will try to reload the failing image. This is a lot of unnecessary network usage and churn.
Any ideas how to make it stop trying to load after the first failure? It doesn't look like Glide itself has this feature (maximum retries, for instance).
Thanks!
The text was updated successfully, but these errors were encountered:
One approach is to remember load failure outside the GlideImage function call:
var failedToLoad by mutableStateOf(false)
...
if (!failedToLoad) {
GlideImage(
...
failure = {
failedToLoad = true
}
...
)
}
Trying this, I see that a new instance of failedToLoad is created on occasion, wiping out whatever the saved state is and potentially allowing a new failing network call, which means (I think) that I need to hoist that state higher into something that's not subject to recomposition, like a view model. Or figure out why the recomposition is creating an entirely new instance of failedToLoad sometimes, which is probably just a problem with my compose code.
@kurteous, Thanks for sharing your idea with me!
In 2.0.1-SNAPSHOT, recomposition performance was improved so It might work without the tricky solution you've suggested. Could you build with the snapshot version?
We have a case where we may get a bad URL as input, and the image will fail to load. In this case, upon every recomposition
GlideImage
will try to reload the failing image. This is a lot of unnecessary network usage and churn.Any ideas how to make it stop trying to load after the first failure? It doesn't look like Glide itself has this feature (maximum retries, for instance).
Thanks!
The text was updated successfully, but these errors were encountered: