Handle browser hard refresh

  • I think this is more a generic Vue / client-side problem but thought I’d see if anybody had handy tricks here considering Quasar.

    Basically, how do you warn a user that they are doing a hard refresh which will blow away their Vuex / auth state?

    I’ve seen some suggestions on using a beforeUnload handler attached to the main app. Anybody have experience, particularly something that would not mess up how the app behaves within Cordova under iOS/Android?


  • Had the same issue a long time ago, I think I have used an extra plugin called Vuex Persisted State.
    You can find it here https://www.npmjs.com/package/vuex-persistedstate

  • Cool, thanks @eleina! I’ll investigate going down that path. I was also thinking of trying to just warn the user for starters (i.e. are you sure you want to refresh the page, you’ll lose any unsaved work). Main reason being the app I’m working on has data that is a little sensitive to persist.

    Appreciate the suggestion, will let you know how it goes.

Log in to reply