Skip to content
This repository was archived by the owner on Feb 5, 2021. It is now read-only.

Make renderAsState public, make WorkflowContainer take a ViewEnvironment. #32

Merged
merged 1 commit into from
May 29, 2020

Conversation

zach-klippenstein
Copy link
Collaborator

This narrows the scope of WorkflowContainer to be only for showing a workflow's renderings
using a ViewEnvironment. This elimnates the need to have separate overloads for workflows
with rendering type ComposeRendering, and is more idiomatic – the old WorkflowContainer
wasn't a "container" in any Compose-y sense of the word, and it was really weird that it took
a content function. Now this composable is actually a container for all workflow-related
composables, and so I think the name is actually appropriate (closes #22).

To render a workflow without a ViewEnvironment, renderAsState is now public. This is also
much more idiomatic, as it resembles APIs like Flow<T>.collectAsState and
Observable.subscribeAsState.

@zach-klippenstein zach-klippenstein force-pushed the zachklipp/renderasstate branch from 8e3b85c to 9978a18 Compare May 28, 2020 22:57
@zach-klippenstein zach-klippenstein marked this pull request as ready for review May 28, 2020 22:57
@zach-klippenstein zach-klippenstein force-pushed the zachklipp/renderasstate branch from 9978a18 to 14148a8 Compare May 28, 2020 23:02
…ent.

This narrows the scope of `WorkflowContainer` to be only for showing a workflow's renderings
using a `ViewEnvironment`. This elimnates the need to have separate overloads for workflows
with rendering type `ComposeRendering`, and is more idiomatic – the old `WorkflowContainer`
wasn't a "container" in any Compose-y sense of the word, and it was really weird that it took
a content function. Now this composable is actually a container for all workflow-related
composables, and so I think the name is actually appropriate (closes #22).

To render a workflow without a `ViewEnvironment`, `renderAsState` is now public. This is also
much more idiomatic, as it resembles APIs like `Flow<T>.collectAsState` and
`Observable.subscribeAsState`.
@zach-klippenstein zach-klippenstein force-pushed the zachklipp/renderasstate branch from 14148a8 to 4a5373a Compare May 29, 2020 00:21
@zach-klippenstein zach-klippenstein requested a review from rjrjr May 29, 2020 00:21
@zach-klippenstein
Copy link
Collaborator Author

Fixed tests, added more tests, and refactored renderAsStateImpl a bit. @rjrjr PTAL.

* this value changes while this function is in the composition, the runtime will be restarted.
*/
@Composable
fun <PropsT, OutputT : Any, RenderingT> Workflow<PropsT, OutputT, RenderingT>.renderAsState(
Copy link
Contributor

Choose a reason for hiding this comment

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

This is so clean. It has that "this is obviously the right thing to do, why did we do anything else" feel to it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep. It's almost the exact same API as Flow/Rx subscriptions in Compose too.

@rjrjr
Copy link
Contributor

rjrjr commented May 29, 2020

Unclear to me what all changed since the first review this morning. Still LG.

@zach-klippenstein zach-klippenstein merged commit 5730afa into master May 29, 2020
@zach-klippenstein zach-klippenstein deleted the zachklipp/renderasstate branch May 29, 2020 00:56
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Figure out a better name for WorkflowContainer
2 participants