Skip to content

Problem in nested navigation #1639

Answered by tgrapperon
inwoodev asked this question in Q&A
Nov 9, 2022 · 3 comments · 15 replies
Discussion options

You must be logged in to vote

Hey @inwoodev! The usual suspect with navigation glitches in SwiftUI is too much state being observed by your ViewStore.
I'm not seeing your ViewStore declaration, but it is likely that you're observing the whole domain's state. You should probably carve-out a ViewState where you expose only what's strictly required to render your view. You can check the Performance article about ViewStates for more informations.
A few additional comments:

  • You need to apply this technique everywhere. The problem can be created by a ViewStore observing too much state higher in the hierarchy.
  • You will need to adapt your bindings so they can work with a ViewState. See #769 for example.

Replies: 3 comments 15 replies

Comment options

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

Answer selected by inwoodev
Comment options

You must be logged in to vote
5 replies
@tgrapperon
Comment options

@inwoodev
Comment options

@tgrapperon
Comment options

@inwoodev
Comment options

@tgrapperon
Comment options

Comment options

You must be logged in to vote
9 replies
@tobitech
Comment options

@tobitech
Comment options

@tgrapperon
Comment options

@tobitech
Comment options

@tgrapperon
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants