I'm observing a data resurrection after localStorage.clear()
or deleteRecord()
(jsbin example) is called in my ember app.
Follow these steps to replicate the problem:
- Open up chrome web dev --> Resources --> Local Storage --> "http://jsbin.com"
- Add some orgs on this page and observe that they are added to local storage
- Click on "Clear local storage" (case 1) or "Delete Org data" (case 2) and observe that the local storage is cleared. Do not refresh the page. (Data still remain on the page but that's okay because we haven't refreshed the page.)
- Add one more org and observe that all the deleted orgs are resurrected (case 1) or LS is not deleted (case 2)
- So when you refresh the page, ALL THE DELETED DATA ARE RESURRECTED.
Questions:
- Why does this data resurrection happen?
- How can I make localStorage.clear() work even without a refresh after clear (either manually or calling
location.reload
)?
edited later to include deleteRecord()