I\'m observing a data resurrection after localStorage.clear()
or deleteRecord()
(jsbin example) is called in my ember app.
Follow these ste
Problem fixed in September's version of Ember Data/Local Storage. See it in action in this SO Answer with a jsbin.
After some discussions with folks on IRC, there is currently a bug in LSAdapter or in Ember Data that causes the data to linger around.
The problem is on pause as of August 2013 due to imminent changes in Ember Data.
The work-around for this problem is to both clear the Local Storage as well as the ember data. See it working in this jsbin.
Alternatively, you can immediately call location.reload()
after clearing local storage to show the fresh data.
Wiping localStorage with clear
works just OK. It is your local storage adapter (LSAdapter) that keeps the state and repopulate previously cleared localStorage on creating new record. This is done that way because records are stored in a string and LSAdapter
don't know if you've changed it or not, so it always save all the records to be sure it is synced.
Consider destroying all the records instead of clearing localStorage.