`NavigationSplitView` with `NavigationStack`(s) using different $paths experiences unexpected behavior

We encounter an issue where the nested each NavigationStack within a NavigationSplitView is bound to a different path but the bound path isn't honored in a way that we would expect.

In this sample app there are 4 routes:

  • Inbox/Inbox (path root)
  • Inbox/Message
  • Outbox/Outbox (path root)
  • Outbox/Message

The NavigationRouter is responsible for updating state such that:

  • the NavigationSplitView sidebar is bound to category
  • the NavigationStack path is bound to 2 different paths, depending on which sidebar category is selected.

We encounter an issue when we want to change routes:

[Inbox/Message] -> [Outbox/Message]

(note the change to a path where depth is deeper than root)

Brings us to a route destination in the UI:

[Outbox/Outbox]

(note the change is made but the UI is at root)

What appears to be happening is that the NavigationSplitView:

  • honors the category change is honored in the sidebar
  • actively sets the current bound navigation path to an empty path: []
  • does not honor the newly bound destination path at depth

Does anyone know how we would be able to achieve what is being described above? I fear I will have to write a UIKit wrapper for what should seemingly be possible with the code supplied here.

Here is a link to a gist demonstrating a full repro case.

`NavigationSplitView` with `NavigationStack`(s) using different $paths experiences unexpected behavior
 
 
Q