[Vuejs]-Cordova local storage doesn't clear when new app is installed

1👍

This is a default behavior and i think it is okay like that.
Otherwise the users must login after each App update.

But of course there are situations where you have to migrate your stored data.

Thats why i run a migrations in main.js which just compares both versions (the currentAppVersion and the storedAppVersion)

If you want to delete all content from localStorage you must go to
Settings->Apps search your App and there klick on storage.
Now you have 2 Buttons to delete everything.

Hope that helps you

👤Thomas

0👍

I managed to use a reducer for Vuex Persist to exclude the ‘appVersion’ value from the store.

 const vuexPersist = new VuexPersist({
  key: 'appStore',
  storage: localStorage,
  reducer: state => // exclude certain values from being persisted
    Object.keys(state).reduce((acc, curr) => {
      if (!['appVersion'].includes(curr)) acc[curr] = state[curr];
      return acc;
    }, {}),
});

Leave a comment