Explore Library
Code Quiz

Deep Link Into NavigationStack

Spot the bug in a SwiftUI NavigationStack deep-link that appends a route but shows nothing.

Codeswift
enum Route: Hashable {
    case product(id: String)
}

struct ContentView: View {
    @State private var path: [Route] = []

    var body: some View {
        NavigationStack(path: $path) {
            List {
                NavigationLink("Home", value: Route.product(id: "0"))
            }
            .navigationTitle("Shop")
        }
        .navigationDestination(for: Route.self) { route in
            if case let .product(id) = route {
                Text("Product \(id)")
            }
        }
        .onOpenURL { url in
            if let id = url.host {
                path.append(.product(id: id))
            }
        }
    }
}

The deep link appends a route and the path updates, but no product screen ever appears. What is the bug?