Data problems of re-login after single page exit

first introduce the basic situation: App is packaged into Android App with cordova , and it is done with Vue, Vuex, Vue-router (pure h5 web app). The current situation is that many pages use the keep-alive cache, such as various list pages, so there is a data cache when you enter these list pages again. You don"t have to refresh the data once without entering it. Just drop down and refresh the data if you want to update.

the problem is this: when user A logs out and then logs in to another user B, when user B clicks into the list page, he sees the list data previously cached by user A. How to ensure that these cached pages can be automatically refreshed again?

my current idea is to reload the page directly after a successful login, rather than a simple route jump. I wonder if there is a better solution?

Apr.08,2022

reloading the page is the fastest solution, or you can add a key to the keep-alive component, which can be the name or id of the currently logged-in user.

Menu