Infinite loop using NavigationStack

Hello.

I've seen some other posts about NavigationStack, but my variation seems a little different.

FYI, I have not migrated from ObservableObject to Observable yet. However, having a path in either seems to be a factor in this issue.

My code has no issues when built with Xcode 15.

When built with Xcode 16 I keep hitting scenarios where the .onAppear for my first tab gets called over and over again endlessly.

If I go to my second tab, which uses a NavStack with a path and then navigate anywhere my .onAppear for my FIRST tab gets call endlessly. I’ll sometimes see a “double push” to the stack. (Someone posted a video of this happening on Mastodon, which apparently I’m not allowed to link to here.) The second tab is accessing the path property via an @EnvironmentObject.

I can stop this endless loop by removing @Published from the property in my ObservableObject that holds my path.

But then if I go to my third tab, which does NOT use a path, the .onAppear for my FIRST tab again gets called endlessly.

So far on Mastodon I’ve seen three people encountering problems possibly related to storing a path in something being observed.

Feedback requires a sample project, which I am having trouble creating to show the problem.

I was able to recreate the double push part of the problem so I opened feedback.

FB14270042

Infinite loop using NavigationStack
 
 
Q