Skip to content
Discussion options

You must be logged in to vote

@satoshin21 This is perhaps a SwiftUI bug that was fixed in Xcode 13, but it has to do with how much state is being observed. Right now MainView is observing all of app state, and in earlier versions of SwiftUI, this could lead to recreating NavigationLinks on state updates (since WithViewStore's content is re-computed, which will reinitialize the NavigationLink each time), and this can pop you from a presented view.

The Composable Architecture comes with tools for focussing on just the state a view cares about via WithViewStore and Store.scope, you just have to be careful with any store you pass to WithViewStore. This means trying not to observe child state in a view that also presents t…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@satoshin21
Comment options

Answer selected by satoshin21
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants