I have a beforeCreate async function like this:
beforeCreate: async function () {
const store = useStore()
const company = store.getters.company
if (!company) {
//need to load main data
const data = await load()
console.log('setting company to ', data[0])
await store.dispatch('setCompany', data[0])
}
},
However, even though Tabs mounted lifecycle method gets executed when the async beforeCreate function was resolved… ProfileTab which is a children route of /tabs/ gets executing without waiting for the parent route to be resolved… (on ProfileTab I was waiting for company on the store, but as is executed before Tabs was mounted, it was null
Tabs.vue?36e0:62 created tab component
ProfileTab.vue?dafe:147 setting up child tab component
ProfileTab.vue?dafe:148 company----> null
ProfileTab.vue?dafe:137 created child tab component
ProfileTab.vue?dafe:140 mounted child tab component
Tabs.vue?36e0:80 mounted tab component