vinay
03/04/2020, 8:56 PMRay Ryan
03/04/2020, 8:57 PMRay Ryan
03/04/2020, 8:57 PMWorkflowRunner
is already as tied into the lifecycle as you should need to be.Zach Klippenstein (he/him) [MOD]
03/04/2020, 8:59 PMvinay
03/04/2020, 9:03 PMRay Ryan
03/04/2020, 9:03 PMRay Ryan
03/04/2020, 9:04 PMWorkflowRunner
should allow you to update the props, looking for a snippet.vinay
03/04/2020, 9:05 PMWorkflowFragment
Ray Ryan
03/04/2020, 9:05 PMvinay
03/04/2020, 9:05 PM* A fragment to run a workflow whose configuration may need to be updated could
* provide a method like this:
*
* class HelloWorkflowFragment : WorkflowFragment<HelloInput, Unit>() {
* private val inputs = BehaviorSubject.createDefault(HelloInput.Fnord)
*
* fun input(input: HelloInput) = inputs.onNext(input)
*
* override fun onCreateWorkflow(): Config<HelloInput, Unit> {
* return Config(
* workflow = HelloWorkflow,
* inputs = inputs
* )
* }
* }
*/
Ray Ryan
03/04/2020, 9:05 PMRay Ryan
03/04/2020, 9:06 PMRay Ryan
03/04/2020, 9:08 PMandroidx.lifecycle.Lifecycle.State
in the props. 🙂vinay
03/04/2020, 9:10 PMRay Ryan
03/04/2020, 9:10 PMvinay
03/04/2020, 9:10 PMZach Klippenstein (he/him) [MOD]
03/04/2020, 9:18 PMvinay
03/04/2020, 9:21 PMRay Ryan
03/04/2020, 9:21 PMRay Ryan
03/04/2020, 9:22 PMRay Ryan
03/04/2020, 9:22 PMvinay
03/04/2020, 9:25 PMRay Ryan
03/04/2020, 9:27 PMval cleanup: Boolean
Ray Ryan
03/04/2020, 9:27 PMRay Ryan
03/04/2020, 9:27 PMRay Ryan
03/04/2020, 9:28 PMRay Ryan
03/04/2020, 9:28 PMZach Klippenstein (he/him) [MOD]
03/04/2020, 9:30 PMvinay
03/04/2020, 9:33 PMContainerHints
so the layour runner can reference the map. Nothing else in the app mutates the map while the workflow is attached.vinay
03/04/2020, 9:35 PMZach Klippenstein (he/him) [MOD]
03/05/2020, 4:39 PMZach Klippenstein (he/him) [MOD]
03/05/2020, 5:33 PMwhenever we introduce a workflow as a part of some flow in our app, we end up doing something messy to implement clean up logic since layout runners don’t get notified (AFAIK) when workflows terminate`LayoutRunner`s can handle cleanup by listening to when their view is detached. We probably need to document this explicitly. `Workflow`s can handle cleanup by using a
LifecycleWorker
and implementing onStopped
. If a LayoutRunner
needs to differentiate between its being detached due to something like config change, and due to the backing workflow going away, that’s a smell that one of them is trying to do too much.
In fact, `LayoutRunner`s aren’t tied to workflows directly at all – theoretically, a container runner could decide to start or stop running a child runner independently from changes in the workflow tree (e.g. using ContainerHints
).Zach Klippenstein (he/him) [MOD]
03/05/2020, 5:37 PMworkflow termination is handled in non-workflow landNot sure what you mean exactly. You mean that non-workflow code needs to be aware of when a workflow terminates? There are two ways to handle this:
Worker
being run by the workflow is cancelled, or the workflow’s rendering stops being emitted. Although either of these things can occur for reasons other than the workflow actually stopping. The actual workflow lifecycle is not exposed by design.