coil
coil copied to clipboard
AsyncImagePainter should use `rememberCoroutineScope`
Is your feature request related to a problem? Please describe.
Currently, AsyncImagePainter uses Dispatchers.Main.immediate. This normally works fine but during Paparazzi screenshot tests they use a custom dispatcher for composables to synchronize time.
Describe the solution you'd like
If possible AsyncImagePainter should use rememberCoroutineScope instead.
Hello! @ansman @colinrtwhite
Will this change fix the issue on jvm("desktop") since there is no Dispatchers.Main there?
Currently, AsyncImage throws an error on desktop: module with the main dispatcher had failed to initialize
It's good to use the same context or scope used inside the composer, or use Dispatchers.Swing for desktop instead of main
As long as rememberCoroutineScope() handles it
@tamimattafi That is intended behaviour and not a bug. See here and here. This is also explained in the docs here.
@colinrtwhite Thank you, I already added swing but still getting the error, it seems like some other library is overriding the main dispatcher, will look into it.