ember.js - EmberJS Model find not up-to-date with underlying store -


for simple overview screen have developed route sets controller app.location.find().

app.locationsindexroute = ember.route.extend({    setupcontroller: function(controller) {     controller.set('content', app.location.find());   },    rendertemplate: function() {     this.render('locations.index',{into:'application'});   }  }); 

i naively assumed go store , fetch me records, giving me up-to-date view of records.

apparently not....

  • when external process starts removing records database, app.location.find() keeps on returning these deleted records. (although rest call doesn't show them anymore)
  • if external process starts adding records database, app.location.find() picks them up.
  • if delete records form within ember app model correctly updated.

how should deal in ember app ? i'd have up-to-date view on whatever in database. right need refresh page (f5) date view. using linkto helpers shows me stale data.

this seems yet trivial thing missed in emberjs. somewhere mentioned in docs why behaves ? guess there valid philosophy behind behavior.

my overview screens interested in showing up-to-date data. if record no longer in db model should not return anymore.

i've added sample project in github having issues.

try unloading of data store before call find():

this.store.unloadall('widget'); this.store.find('widget'); 

that refresh store reflect what's on server.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -