Skip to content

Commit daf05f3

Browse files
Merge pull request #62 from johnpatrickmorgan/fix-path-propagation
Fix path state propagation when using NavigationStack
2 parents 91ed751 + 7418c73 commit daf05f3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Sources/NavigationBackport/NBNavigationStack.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,22 @@ public struct NBNavigationStack<Root: View, Data: Hashable>: View {
6868
}
6969
}
7070
.onChange(of: externalTypedPath) { externalTypedPath in
71+
guard path.path != externalTypedPath.map({ $0 }) else { return }
7172
guard isUsingNavigationView else {
73+
path.path = externalTypedPath.map { $0 }
7274
return
7375
}
74-
guard path.path != externalTypedPath.map({ $0 }) else { return }
7576
guard appIsActive.value else { return }
7677
path.withDelaysIfUnsupported(\.path) {
7778
$0 = externalTypedPath
7879
}
7980
}
8081
.onChange(of: internalTypedPath) { internalTypedPath in
82+
guard path.path != internalTypedPath.map({ $0 }) else { return }
8183
guard isUsingNavigationView else {
84+
path.path = externalTypedPath.map { $0 }
8285
return
8386
}
84-
guard path.path != internalTypedPath.map({ $0 }) else { return }
8587
guard appIsActive.value else { return }
8688
path.withDelaysIfUnsupported(\.path) {
8789
$0 = internalTypedPath

0 commit comments

Comments
 (0)