Skip to content

Conversation

@steve-the-edwards
Copy link
Contributor

No description provided.

@steve-the-edwards steve-the-edwards marked this pull request as ready for review July 23, 2025 15:54
Base automatically changed from zachklipp/dispatcher-runtime to main July 23, 2025 16:58
* 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!
Copy link
Collaborator

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.

Copy link
Collaborator

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.renderAsState to sidestep thinking about this. Too much?
  • Did we ever extend renderAsState to allow a config to be passed in?

Copy link
Contributor Author

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!

Copy link
Contributor Author

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!

Copy link
Contributor Author

@steve-the-edwards steve-the-edwards Jul 23, 2025

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.
Copy link
Collaborator

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think probably?

@steve-the-edwards steve-the-edwards force-pushed the sedwards/remove-compose-requirement branch from f21e1d6 to 6fb83b3 Compare July 23, 2025 19:18
@steve-the-edwards steve-the-edwards requested a review from a team as a code owner July 23, 2025 19:18
@steve-the-edwards steve-the-edwards force-pushed the sedwards/remove-compose-requirement branch from 6fb83b3 to d4acbf6 Compare July 24, 2025 15:50
@steve-the-edwards steve-the-edwards force-pushed the sedwards/remove-compose-requirement branch from d4acbf6 to bd09ff7 Compare July 24, 2025 15:50
@steve-the-edwards steve-the-edwards merged commit 6515060 into main Jul 24, 2025
132 of 134 checks passed
@steve-the-edwards steve-the-edwards deleted the sedwards/remove-compose-requirement branch July 24, 2025 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants