Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AsyncImagePainter should use rememberCoroutineScope #2181

Open
ansman opened this issue Mar 25, 2024 · 4 comments · May be fixed by #2220
Open

AsyncImagePainter should use rememberCoroutineScope #2181

ansman opened this issue Mar 25, 2024 · 4 comments · May be fixed by #2220
Labels
enhancement New feature or request

Comments

@ansman
Copy link

ansman commented Mar 25, 2024

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.

@ansman ansman added the enhancement New feature or request label Mar 25, 2024
@tamimattafi
Copy link

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

@ansman
Copy link
Author

ansman commented May 9, 2024

As long as rememberCoroutineScope() handles it

@colinrtwhite
Copy link
Member

colinrtwhite commented May 9, 2024

@tamimattafi That is intended behaviour and not a bug. See here and here. This is also explained in the docs here.

@tamimattafi
Copy link

@colinrtwhite Thank you, I already added swing but still getting the error, it seems like some other library is overriding the main dispatched, will look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants