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

scopes with client lambdas will not get updated #88

Open catmando opened 6 years ago

catmando commented 6 years ago

on the same client that makes an update.

I.e. if data is updated on server and is broadcast then all is well but if data is updated on one client, then that client will not get updated

probably because when update_filter_scope in scoped_collection.rb runs, the local data is already updated, so that there is no "difference" before and after.

solution is probably around checking the "before" values returned from the server against what is in the client. If the value is "before" does not equal the current value (but instead equals the new value) then we know we have to change the record so that it matches what is coming down from the server.

FYI this can fix another problem and that is that models that are not kept in sync. In this case we should simulate the "before->after" json returned from the server and use this to update the scopes. Or we could return the "broadcast" data with the update/save.

catmando commented 6 years ago

closed ab8637bc2b3a250f1e74544245375cb9806a7442