Meta Info Bug. Not Updating
juanbonoso opened this issue ยท 7 comments
Hi,
First, thanks for this awesome plugin , i really like it.
I just realized that meta info, is not being update when i pass from one page to another with
this.$navigator.navigate();
I use the loaded page event from nativescript to verify if the user have autorization to open a particular page:
public loadPage() {
this.store.auth.isLoggedIn().then(isLoggedIn => {
if (!isLoggedIn) {
console.log(this.$navigator.route.meta.needsAuth);
console.log(JSON.stringify(this.$navigator.route.meta));
if (this.$navigator.route.meta.needsAuth) {
// this.$navigator.navigate('/OnBoard', { clearHistory: true });
}
}
});
The console.log will always show:
true
'{"needsAuth":true,"name":"AdminInterface"}'
AdminInterface is the page, where loadPage is triggered. I also have the same loadPage in OnBoard where triggers the same output from AdminInterface all the time, which makes my app to enter in infinite Loop, navigating every second to OnBoard.
routes file:
'/OnBoard': {
component: OnBoard,
meta: {
needsAuth: false,
name: 'OnBoard',
},
props: {
userType: '',
},
},
'/AdminInterface': {
component: AdminInterface,
meta: {
needsAuth: true,
name: 'AdminInterface',
},
props: {
userType: '',
},
}
I suspect the meta is not yet showing the new route's meta in the @loaded event. Can you try adding a slight delay with setTimeout just to confirm the case?
@rigor789 I just tried it with a setTimeOut of 10 seconds (10000 miliseconds), and did not work. So it is not the loaded event.
@juanbonoso are you using using class style Vue components?
@superalex I am using vue class components.
Yes, I just read your issue and we have the same problem.