Skip to content
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

Questions Edit Route #15

Open
ghost opened this issue Aug 14, 2017 · 0 comments
Open

Questions Edit Route #15

ghost opened this issue Aug 14, 2017 · 0 comments
Labels

Comments

@ghost
Copy link

ghost commented Aug 14, 2017

When going directly to the questions edit route (on first load of the zite), there is a problem where I am not able to access the site_info from the before hook (I need to access it to check that the current user is the one who posted the question, if not, I don't let the route resolve - by returning false from the before hook).

This is because the before hook is happening before site_info is set. Usually this would be fixable by just calling the function that set's site_info before the function that eventually calls the before hook, however this is already the case and it doesn't work because the ZeroFrame command that set's site_info happens asynchronously - it doesn't wait until it is done before eventually calling the before hook.

I could fix this by having the Router start (init) in the callback function from the ZeroFrame command. This would wait until site_info is set before the router starts working. However, not only will the routing lag until the site_info is set (only on first load of the zite) but also setting the correct vuejs component for the current route will lag.

The other way I could fix this is just by allowing the route to resolve, then once site_info is set, check that the current user can edit the question, and if not, navigate back. However, this will show the page for a second (until site_info is set), then go back instead of it just not showing the page at all.

@ghost ghost added the bug label Aug 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants