automerge / automerge-repo-swift

Extends the Automerge-swift library, providing support for working with multiple Automerge documents at once, with pluggable network and storage providers.
https://swiftpackageindex.com/automerge/automerge-repo-swift/documentation/automergerepo
MIT License
23 stars 4 forks source link

adds state published to WebSocketNetworkProvider #90

Closed heckj closed 5 months ago

heckj commented 5 months ago

resolves #88

jessegrosjean commented 5 months ago

Thanks this will be very useful. I'm a casual combine user, but wondering why this is a PassThroughSubject instead of a CurrentValueSubject. I think in common usage case (subscribe once and early) it doesn't matter, but generally I would think state would be better modeled by CurrentValueSubject?

heckj commented 5 months ago

Can easily do that. I tend to lean into PassthroughSubject because it doesn't require an initial value, so it's often far easier to work with. In this case, an initial value of .disconnected would be fine, as the value flow on this is a pretty simple looping state machine setup. I'll open a PR to switch that up

heckj commented 5 months ago

updated with #91