mirror of
https://github.com/pointfreeco/swift-composable-architecture.git
synced 2025-12-20 09:11:33 +01:00
Child store caching improvements (#2627)
* Use `ScopeID` for all cached child stores * wip * wip * wip * wip * wip * wip
This commit is contained in:
@@ -29,15 +29,11 @@ public struct NavigationStackStore<State, Action, Root: View, Destination: View>
|
||||
) {
|
||||
self.root = root()
|
||||
self.destination = { component in
|
||||
var state = component.element
|
||||
return destination(
|
||||
destination(
|
||||
store
|
||||
.scope(
|
||||
state: {
|
||||
state = $0[id: component.id] ?? state
|
||||
return state
|
||||
},
|
||||
id: { _ in component.id },
|
||||
state: { $0[id: component.id]! },
|
||||
id: store.id(state: \.[id: component.id]!, action: \.[id: component.id]),
|
||||
action: { .element(id: component.id, action: $0) },
|
||||
isInvalid: { !$0.ids.contains(component.id) },
|
||||
removeDuplicates: nil
|
||||
@@ -69,15 +65,11 @@ public struct NavigationStackStore<State, Action, Root: View, Destination: View>
|
||||
) where Destination == SwitchStore<State, Action, D> {
|
||||
self.root = root()
|
||||
self.destination = { component in
|
||||
var state = component.element
|
||||
return SwitchStore(
|
||||
SwitchStore(
|
||||
store
|
||||
.scope(
|
||||
state: {
|
||||
state = $0[id: component.id] ?? state
|
||||
return state
|
||||
},
|
||||
id: { _ in component.id },
|
||||
state: { $0[id: component.id]! },
|
||||
id: store.id(state: \.[id: component.id]!, action: \.[id: component.id]),
|
||||
action: { .element(id: component.id, action: $0) },
|
||||
isInvalid: { !$0.ids.contains(component.id) },
|
||||
removeDuplicates: nil
|
||||
|
||||
Reference in New Issue
Block a user