Kamel-Media / Kamel

Kotlin asynchronous media loading and caching library for Compose.
Apache License 2.0
595 stars 23 forks source link

Fix error state infinite recomposition #10

Closed outadoc closed 2 years ago

outadoc commented 2 years ago

This PR attempts to fix issue #9, where a network error would cause the images to be retried infinitely. The issue contains more info on how to reproduce the problem in order to test the fix.

From my investigation, the bug was caused because resourceConfig was recreated on every composition. Since it is used as a key for the LaunchedEffect in loadPainterResource, that effect would be restarted on every composition, which we really don't want.