-
Notifications
You must be signed in to change notification settings - Fork 112
Remove Compose Dependency from Android Runtime #1379
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
Conversation
| * for Workflow. | ||
| * synchronously). We recommend using a `CoroutineDispatcher` in this scope's `CoroutineContext` | ||
| * that will ensure that all dispatched coroutines are run before the next Choreographer frame. | ||
| * Compose UI's `AndroidUiDispatcher.Main` provides this behavior in a performant way! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should update all the compose samples to demonstrate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Could also mention that compose apps can use
Workflow.renderAsStateto sidestep thinking about this. Too much? - Did we ever extend
renderAsStateto allow a config to be passed in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point about the samples!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we ever extend renderAsState to allow a config to be passed in?
I don't think so!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we ever extend renderAsState to allow a config to be passed in?
Turns out we did. It takes the scope by default from rememberCoroutineScope() which will take it from Compose which will likely be AndroidUiDispatcher.Main on Android.
| ): StateFlow<RenderingT> { | ||
| val restoredSnap = savedStateHandle?.get<PickledTreesnapshot>(KEY)?.snapshot | ||
|
|
||
| // Add in Compose's AndroidUiDispatcher.Main by default if none is specified. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be too magical to use reflection to look for AndroidUiDispatcher.Main and default to it if available?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think probably?
f21e1d6 to
6fb83b3
Compare
6fb83b3 to
d4acbf6
Compare
d4acbf6 to
bd09ff7
Compare
No description provided.