Skip to content
Discussion options

You must be logged in to vote

Hi @Alex0Klain, the problem is in the lines where you are constructing the view store, such as this:

    WithViewStore(
      self.store,
      observe: { $0 }
    ) { viewStore in

…and this:

self.viewStore = ViewStore(store)

You are observing all of state in both cases, even though you only need a small amount of state. The PagerView only needs currentIndex and MovieView only needs id. You should be using the observe argument to chisel away at the bare minimum of state that the view needs to do its job. There is an entire article devoted to this subject.

Also, this bit of code is very problematic:

struct MovieView: View {
  init(
    _ store: Store<MovieState, MovieActions>
  ) {
    self.

Replies: 1 comment 1 reply

Comment options

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

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