Skip to content

Meta Info Bug. Not Updating #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
juanbonoso opened this issue Mar 23, 2020 · 7 comments
Closed

Meta Info Bug. Not Updating #30

juanbonoso opened this issue Mar 23, 2020 · 7 comments

Comments

@juanbonoso
Copy link

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: '',
		},
	}

@rigor789
Copy link
Member

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?

@juanbonoso
Copy link
Author

@rigor789 I just tried it with a setTimeOut of 10 seconds (10000 miliseconds), and did not work. So it is not the loaded event.

@superalex
Copy link
Contributor

superalex commented Mar 26, 2020

@juanbonoso are you using using class style Vue components?

@juanbonoso
Copy link
Author

@superalex I am using vue class components.

@superalex
Copy link
Contributor

So I think we have the same issue: #31

@juanbonoso
Copy link
Author

juanbonoso commented Mar 26, 2020

Yes, I just read your issue and we have the same problem.

@rigor789
Copy link
Member

Let's consolidate this into #31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants