Would it be possible to have a feature on the store where we can remove all records from the store for a particular type, regardless of the state they are in?
This is similar to
unloadAll but works on new and dirty records (which unloadAll does not at the moment).
My use case is that when a user signs out of my app, I want to remove all user related records from the store (but keep “public” records).
unloadAll does not work in this use case because I want to get rid of the records regardless of the state that they are in (as the user is signing out, the records need to be removed without any questions asked!).
I’m currently achieving this by filtering out all new and dirty records and dealing with them before calling
unloadAll on the store. This works but doesn’t seem entirely efficient. I believe my use case is fairly generic so will apply to lots of other applications out there.
I’d suggest a method such as
purgeAll, but I’m not fussy about the names!
I’ve never delved into the Ember-Data code so don’t know how to write something to do this right now. So posting as a feature request now… there’s a chance I might be able to delve into the code and look at this myself in the future, but it’s not going to happen in the next month or two because of what I’m working on at the moment.