0๐
I think what might be happening is that your userProfile
data in Vuex is set only after the component has mounted when you directly refresh the page? In that case userProfile.name
might still be undefined when you assign it. If this is what happens, you could add a watcher in this component that checks for changes in the userProfile
and updates the localProfile
if it hasnโt been set during the mount.
Also: have you looked at the v-once directive? https://v2.vuejs.org/v2/api/#v-once
This should prevent the username from being updated when the value changes without having to reference a local copy.
- [Vuejs]-How to show components on the right side of Vuetify's NavigationDrawer using VueRouter?
- [Vuejs]-Vue: Limiting users with certain roles have access to certain pages in the router vue-element-admin
Source:stackexchange.com