Replies: 3 comments 11 replies
-
Yes, you an adapt your new reducer into an In my project, something like this: expenseDomainReducer
.pullback(state: \Identified.value, action: .self)
.optional()
.pullback(state: \SignedInState.selectedExpense,
action: /SignedInAction.expense,
environment: { ExpenseDomain.Environment(api: $0.api) }) became this: AnyReducer { environment in
ExpenseDomain(environment: .init(api: environment.api))
}
.pullback(state: \Identified.value, action: .self)
.optional()
.pullback(state: \SignedInState.selectedExpense,
action: /SignedInAction.expense,
environment: { ExpenseDomain.Environment(api: $0.api) }) |
Beta Was this translation helpful? Give feedback.
-
We just updated our migration article to describe how to step-by-step migrate optional+pullback reducers: Please let us know if you have any feedback on that. |
Beta Was this translation helpful? Give feedback.
-
These examples only seem to work if the parent and child ReducerProtocols are in the same module. When the child ReducerProtocol is in a separate module, things do not compile. For example public static let reducer = AnyReducer<State, Action, Environment>.combine(
AnyReducer {
RevenueSplitList(databaseClient: $0.databaseClient, uuid: $0.uuid)
}.optional()
.pullback(
state: \.revenueSplitList,
action: /Action.revenueSplitList,
environment: {
RevenueSplitList(
databaseClient: $0.databaseClient,
uuid: $0.uuid) }), Does not compile. The compile thinks $0 in |
Beta Was this translation helpful? Give feedback.
-
A majority of my reducers are optional. Looking at the docs and migration guides, I do not see how to convert an optional ReducerProtocol into an AnyRuder for migration purposes. Has anyone been successful in doing this?
Beta Was this translation helpful? Give feedback.
All reactions