Describe the bug
For example, when navigating to a fragment and calling ImageView.load() in onViewCreated() or onResume(), the image is being loaded correctly. However, when updating the image via an intent, the image in the ImageView is not being updated correctly despite calling ImageView.load() again.
What's weird too is that, when navigating to that same fragment via a BottomNav for example, the image gets refreshed properly.
To Reproduce
This can be reproduced using an ImageView and populate it with an image of a user, then start a pick image intent and update the photo of that user. When onResume() or onViewCreated() is called again, the image itself does not update.
Expected behavior
Coil should provide a force-refresh mechanism.
Library version
0.8.0
Sounds like the image is being served from the memory cache. To fix this you can set a custom cache key using key. If the data changes, your cache key should change and it will miss the memory cache.
Alternately, you can skip reading/writing to the memory cache using:
```kotlin
imageView.load(data) {
memoryCachePolicy(CachePolicy.DISABLED)
}
Thanks! Using the cache keys fixed it for me. There was another bug in my app that caused the activity to finish() before the image upload process was completed.
Most helpful comment
Sounds like the image is being served from the memory cache. To fix this you can set a custom cache key using
key. If the data changes, your cache key should change and it will miss the memory cache.Alternately, you can skip reading/writing to the memory cache using:
```kotlin
imageView.load(data) {
memoryCachePolicy(CachePolicy.DISABLED)
}