ruby-hyperloop / hyper-mesh

The project has moved to Hyperstack!! - Synchronization of active record models across multiple clients using Pusher, ActionCable, or Polling
https://hyperstack.org/
MIT License
22 stars 12 forks source link

Model.all.count increments twice on client doing a save. #94

Open catmando opened 6 years ago

catmando commented 6 years ago

If you do Model.all.count without for example doing a Model.all.each ... . There will be no actual collection of records, just the count.

If you create a new record on the browser, the count (in this case) will increment by 2.

Why? Because on that client it sees the record being created (adds 1 to the count) and then milliseconds later receives a broadcast saying a new record was created (adds 1 to the count).