I was facing an issue while working on one of my Ember Apps. Issue was like, Ember data store was not updating the record after receiving the response from backend.

So whenever user visit the page, it was showing the old data of that record from Ember-Data store. After some searching I found that Ember-data by default doesn't re-request data that is already present in Ember-data store.

If parent route's model has loaded an array of objects then the child route that requires specific object will not make another request.

In such case we can force reload the record.

this.store.findRecord('post', params.post_id, {reload: true});

Although this works with Ember-Data > 2.0, for version < 2.0, we can write

this.store.find('post', params.post_id, {options: reload});

We can also use reload() on the model instance itself.

post.reload();

This will also send a re-request to API.

That's how we can force Ember-data store to always give us fresh data.

reference: Force store reload data, findRecord method documentation

1 Comment

Your comment

*

*