Bahn-X / swift-composable-navigator

An open source library for building deep-linkable SwiftUI applications with composition, testing and ergonomics in mind
MIT License
581 stars 25 forks source link

Replace Path / go(to path:) do not correctly navigate back #16

Closed ohitsdaniel closed 3 years ago

ohitsdaniel commented 3 years ago

Replace path and go to path in the navigator should navigate back to the last matching path element and only then show the non-matching part of the routing path.

Currently, both functions do not set the hasAppeared flag to false. This behaviour can be tested in the example app by opening detail settings 1 and tapping on "Go to detail settings 0".

Expected behaviour: Application navigates back to Home Screen, then pushes detail 0, presents detail settings 0.

Observed behaviour: Application navigates back to Detail Screen, replacing detail 1 with detail 0, navigation no longer works as routing path is broken.

Fix: Set hasAppeared of the last matching path element to false, if it is not the last element in the routing path.