wwt / SwiftCurrent

A library for managing complex workflows in Swift

Home Page:https://wwt.github.io/SwiftCurrent/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Relaunching a workflow using onChange

Tyler-Keith-Thompson opened this issue · comments

Describe the bug

If you use the onChange modifier of a view to listen to when a workflow is no longer launched, then relaunch that way instead of with a .constant(true), the workflow just vanishes.

To Reproduce

Steps to reproduce the behavior: ALL CHANGES TO CONTENTVIEW

  1. In our sample app, modify the profile workflow to have a @State variable that binds it instead of .constant(true)
  2. Add anonChange(of: profileWorkflowShown) { if !$0 { profileWorkflowShown = true } } modified to the TabView, or wherever, it doesn't matter.
  3. Notice that profile simply vanishes and never really re-appears.

Expected behavior

The workflow should relaunch, just as if you were using .constant(true)

Screenshots

You want a screenshot of nothing? Heh, no

Actually, our getting started example showcases this. Once you finish, it does not relaunch.

We seemed to have narrowed this down to in the ModifiedWorkflowView's body that the .onChange(of: isLaunched) is not getting called to launch the workflow again.

We think that part of it might have to do with either the isLaunched check previously or the check of if let body = model.body as? Content