DustinFisher
DustinFisher

Reputation: 396

How do you remove data from the ember store that has been loaded?

As I click on items on my ember app the server is called and the data is loaded in the model store.

My question is how can I remove that data that is loaded in for that specific model to be removed, so that when I click on that item again it would call out to the server again and pull the data back.

I have seen some previous answers that running something like, App.store.findQuery(App.Model, {}), would invalidate the cache, but that does not seem to work.

Is there a way to iterate over just the items that have been loaded into the store and call .reload() on them? or a way to just clear it all out?

Any ideas or help are appreciated.

Upvotes: 2

Views: 1018

Answers (1)

Mike Grassotti
Mike Grassotti

Reputation: 19050

Sounds like what you want to do is unload all of the cached models for a particular type?

//From a route or controller...
this.store.unloadAll('post');

Upvotes: 1

Related Questions