|
Hi, I subscribe to in memory shared value like: and update it in async context like: When callLogs is changed, it triggers ".callLogsChanged" in reducer, but there is still previous value (in my case empty array) in the shared call logs. |
Replies: 3 comments
|
I think that's because i haven't tried it, but the new |
|
In addition to what @pyrtsa mentioned, the return .publisher {
state.$callLogs.publisher
.dropFirst()
.map(Action.callLogsChanged)
case .callLogsChanged(let callLogs):
state.localCallLogs = callLogs
return .none
} |
|
ok, thanks for the answer |
In addition to what @pyrtsa mentioned, the
$callLogs.publisherpublisher emits the actual current value (not the previous value available in thewillSet), and so if you delivered that to your action you would have the freshest value: