Hey team I am in the middle of migrating a TCA app to use the new NavigationStack/NavigationStackStore apis and I took a look at the NavigationDemo (Stack) case study in the case studies app and noticed some weird behaviour and I am attaching video below.
Firstly when "Stack" is tapped on the List we see the NavigationDemo view get pushed and popped off the stack immediately which is unexpected.
Also tapping on one of the destinations doesn't actually do the navigation instead we see the destination reflected in the back button title.
Finally if you tap on the back button, we should be taken to the RootView instead of the destination we previously tapped and tapping on the back button again results in the following fatal error crash:
Swift/RangeReplaceableCollection.swift:902: Fatal error: Can't remove more items from a collection than it contains
2023-08-22 10:43:46.717655-0700 SwiftUICaseStudies[5421:60315599] Swift/RangeReplaceableCollection.swift:902: Fatal error: Can't remove more items from a collection than it contains
Simulator Screen Recording - iPhone 14 Pro - 2023-08-22 at 10.56.51.mp4.zip
Checklist
[X] I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
[X] If possible, I've reproduced the issue using the main branch of this package.
Tapping on "Stack" should push the NavigationDemoView onto the stack and not pop it back automatically.
Tapping on "Go to Screen A" should push Screen A onto the stack and we should be able to see that view instead of the root view, the back button title should read "Screen A" since we are already there.
Tapping on the back button should bring us back to the RootView and a subsequent tap on the back button should bring us back to the CaseStudies list without crashing.
Actual behavior
Firstly when "Stack" is tapped on the List we see the NavigationDemo view get pushed and popped off the stack immediately which is unexpected.
Also tapping on one of the destinations doesn't actually do the navigation instead we see the destination reflected in the back button title.
Finally if you tap on the back button, we should be taken to the RootView instead of the destination we previously tapped and tapping on the back button again results in the following fatal error crash:
Swift/RangeReplaceableCollection.swift:902: Fatal error: Can't remove more items from a collection than it contains
2023-08-22 10:43:46.717655-0700 SwiftUICaseStudies[5421:60315599] Swift/RangeReplaceableCollection.swift:902: Fatal error: Can't remove more items from a collection than it contains.
Steps to reproduce
Run the CaseStudies(SwiftUI) app
Scroll to the Navigation section.
Tap on "Stack".
Tap on "Go to Screen A"
Tap on the back button "< Screen A"
Tap on the back button "< Case Studies"
The Composable Architecture version information
f62ba37cc0c51acb89f6dd1f552f6a1f9c58027c
Destination operating system
iOS 16.4
Xcode version information
Version 14.3 (14E222b)
Swift Compiler version information
swift-driver version: 1.75.2 Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100)
Target: arm64-apple-macosx13.0
Description
Hey team I am in the middle of migrating a TCA app to use the new NavigationStack/NavigationStackStore apis and I took a look at the NavigationDemo (Stack) case study in the case studies app and noticed some weird behaviour and I am attaching video below.
Firstly when "Stack" is tapped on the List we see the NavigationDemo view get pushed and popped off the stack immediately which is unexpected. Also tapping on one of the destinations doesn't actually do the navigation instead we see the destination reflected in the back button title. Finally if you tap on the back button, we should be taken to the RootView instead of the destination we previously tapped and tapping on the back button again results in the following fatal error crash:
Swift/RangeReplaceableCollection.swift:902: Fatal error: Can't remove more items from a collection than it contains 2023-08-22 10:43:46.717655-0700 SwiftUICaseStudies[5421:60315599] Swift/RangeReplaceableCollection.swift:902: Fatal error: Can't remove more items from a collection than it contains Simulator Screen Recording - iPhone 14 Pro - 2023-08-22 at 10.56.51.mp4.zip
Checklist
main
branch of this package.Expected behavior
Tapping on "Stack" should push the NavigationDemoView onto the stack and not pop it back automatically. Tapping on "Go to Screen A" should push Screen A onto the stack and we should be able to see that view instead of the root view, the back button title should read "Screen A" since we are already there. Tapping on the back button should bring us back to the RootView and a subsequent tap on the back button should bring us back to the CaseStudies list without crashing.
Actual behavior
Firstly when "Stack" is tapped on the List we see the NavigationDemo view get pushed and popped off the stack immediately which is unexpected. Also tapping on one of the destinations doesn't actually do the navigation instead we see the destination reflected in the back button title. Finally if you tap on the back button, we should be taken to the RootView instead of the destination we previously tapped and tapping on the back button again results in the following fatal error crash:
Swift/RangeReplaceableCollection.swift:902: Fatal error: Can't remove more items from a collection than it contains 2023-08-22 10:43:46.717655-0700 SwiftUICaseStudies[5421:60315599] Swift/RangeReplaceableCollection.swift:902: Fatal error: Can't remove more items from a collection than it contains.
Steps to reproduce
The Composable Architecture version information
f62ba37cc0c51acb89f6dd1f552f6a1f9c58027c
Destination operating system
iOS 16.4
Xcode version information
Version 14.3 (14E222b)
Swift Compiler version information