After localStorage.clear() or deleteRecord() in my Ember.js app, local storage data are resurrected

后端 未结 2 1121
我在风中等你
我在风中等你 2021-01-13 20:13

I\'m observing a data resurrection after localStorage.clear() or deleteRecord() (jsbin example) is called in my ember app.

Follow these ste

2条回答
  •  醉梦人生
    2021-01-13 20:53

    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.

提交回复
热议问题