You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
case .task:
return .publisher{
state.$sort.publisher.map{ _ in.reload }}.cancellable(id:...)
case .reload:
switch state.sort{...} // previous value
return .none
I saw discussion #128 about accessing the previous value from a publisher. I think that use case can be handled by consumers with scan, whereas this case is about reacting after wrappedValue has already been updated.
Would you consider making Shared.publisher emit after wrappedValue has been updated, or adding a separate post-update/current-value publisher?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! I wanted to ask about the timing semantics of
Shared.publisher.It looks like
Shared.publishercurrently emits beforewrappedValuehas been updated. This works when using the emitted value directly:But when using the publisher as a change trigger, reading the shared value from an extracted method can observe the previous value:
A similar pattern can come up in a TCA reducer:
I saw discussion #128 about accessing the previous value from a publisher. I think that use case can be handled by consumers with
scan, whereas this case is about reacting afterwrappedValuehas already been updated.Would you consider making
Shared.publisheremit afterwrappedValuehas been updated, or adding a separate post-update/current-value publisher?Beta Was this translation helpful? Give feedback.
All reactions