But after some responses i have some doubts and I decided to ask here.
I did a lot of researches on google/starckoveflow/ember doc for understand how to keep my frontend updated with backend and guarantee a good user expirince(no flickering) but I didn’t find nothing that clearly explain how to achieve my needs.
So my doubt is that i didn’t understand emberjs and ember-data.
How can I keep my frontend data synced periodically with my backend? Is ember-data designed for this scope?
in model hook i use this.store.filter instead this store.find and inside onPoll function i use controller.store.find(‘mymodel’).then(function(data){_this.store.pushMany(‘mymo del’, data);});. And this works in part with no flickering: new records are added and existings are updated. The problem is when a record is deleted from backend. Is there the possibility to tell to pushMany function to remove records for which there isn’t an update?
you unload all records of type ‘test’ and ask the sever to give you the entire list of ‘tests’. It’s ok but, you never use the result of this.store.find call. You need to do something with the result the server provides to your calls:
...
this.store.find('test').then(funtion(tests){
do something with the new test record array
});
No. When you’ll be inside the success function of your fulfilled promise, your store as been already populated with the tests objects (which means received a json from the server, parsed/deserialized, created as many DS objects as needed - also related, sideloaded, ones -)
Your liveupdating objects will be auto-updated and you can do additional stuff in the promise success function.