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

Consider removing Unconfined dispatcher as default CoroutineContext for ComposeScene creation #4799

Open
JakeWharton opened this issue May 10, 2024 · 1 comment
Assignees
Labels
discussion Need further discussion to understand if it actually needed enhancement New feature or request runtime Compose runtime problem to be considered

Comments

@JakeWharton
Copy link

I am standing up Compose UI on a new target, and was surprised to see Dispatchers.Unconfined as the default value for the CoroutineContext when setting up a Compose scene. This seems like a dangerous default. I did not initially supply this value and it caused deadlocks in my application.

@MatkovIvan MatkovIvan assigned igordmn and m-sasha and unassigned igordmn May 13, 2024
@m-sasha
Copy link
Contributor

m-sasha commented May 13, 2024

I agree that it's a bad default value, but changing it could break someone's code (after recompilation).

On the other hand, it is really a bad value because:

  1. It causes effects to be run immediately when they are launched, which changes the order relative to what happens normally.
  2. When resuming, it resumes on an unspecified thread.

So maybe it's worth changing even it breaks someone's code.

P.S. We should also change this in tests, as I mentioned here: https://youtrack.jetbrains.com/issue/COMPOSE-1290/LaunchedEffect-run-in-composition-phase-in-tests

@igordmn What do you think?

@MatkovIvan MatkovIvan added discussion Need further discussion to understand if it actually needed to be considered labels May 13, 2024
@igordmn igordmn added enhancement New feature or request runtime Compose runtime problem labels May 14, 2024
@m-sasha m-sasha removed their assignment May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Need further discussion to understand if it actually needed enhancement New feature or request runtime Compose runtime problem to be considered
Projects
None yet
Development

No branches or pull requests

4 participants