You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure... right now, I do something like this when I start the app:
try{JSON.parse(window.localStorage.getItem("storage:pending-data"));}catch(err){window.localStorage.removeItem("storage:pending-data")// eslint-disable-next-line no-consoleconsole.log("the local storage is corrupted: ",err);}
but for me, it's not that critical if this data is lost.
i'm thinking that ideally, it would be nice to have something like this:
Storage.reopenClass({initialState(){return{lastKnownValue: null};},recoverState(stringValue){/// ... do something here or justreturnthis.initialState();}});
or allow the Storage object to serialize/deserialize the data, and handle the errors if there are any... just like ember transforms.
I am not sure how other people use this library, but I am fine with either solution.
It looks like if the stored value can't be parsed, an error is thrown and the default value will not be set.
The text was updated successfully, but these errors were encountered: