Mutating parent on child mutations #424
-
I was struggling with some unnecessary mutations happening in the parent view when child view state changed. Then I found out that one of the CaseStudies has the same behaviour and I wonder how I can workaround it. In Case Study 03. Navigation Sheet Present and Load on each Speaking about this particular example: is it possible to prevent |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
From my understanding of pointFree Episodes, I could say that composable architecture solve this problem by having all your struct conforms to Equatable protocol and having ViewStore on Each View. |
Beta Was this translation helpful? Give feedback.
-
Yeah it is possible. I believe what @abdelmajidrajad is referencing is that we should probably update this line: To chisel away the state to exactly what is needed in the view. So something like: WithViewStore(self.store.scope(state: \. isSheetPresented)) { viewStore in
...
} Then the view would re-compute itself only when the sheet is presented or dismissed. |
Beta Was this translation helpful? Give feedback.
From my understanding of pointFree Episodes, I could say that composable architecture solve this problem by having all your struct conforms to Equatable protocol and having ViewStore on Each View.