wwt / SwiftCurrent

A library for managing complex workflows in Swift
https://wwt.github.io/SwiftCurrent/
Apache License 2.0
307 stars 19 forks source link

[Bug]: Abandon does not dismiss SwiftUI Nav stack #204

Closed Tyler-Keith-Thompson closed 2 years ago

Tyler-Keith-Thompson commented 2 years ago

What happened?

I've got a workflow set up with multiple items, I used the .embedInNavStack() fluent API, but when I call workflow?.abandon() the nav stack doesn't reset. I just stay on the last page.

Version

SwiftCurrent Version: 5.1.4 Xcode Version: 13.4.1 iOS Version: 14+

Relevant code sample

WorkflowView(launchingWith: .init(wrappedValue: appointment)) {
                WorkflowItem(FirstView.self)
                    .presentationType(.navigationLink)
                WorkflowItem(SecondView.self)
                    .presentationType(.navigationLink)
            }
            .embedInNavigationView()

// from inside SecondView
Button("Abandon") {
    workflow?.abandon()
}

Relevant log output

It seems that the body is being published. I suspect we need to listen to calls to `abandon` and then set all `isActive` flags to `false` inside of `WorkflowItemWrapper`

Code of Conduct

Tyler-Keith-Thompson commented 2 years ago

Modals have a weirder behavior, the view vanishes but the modal stays up.

Tyler-Keith-Thompson commented 2 years ago

Also note: backUpInWorkflow does the right thing