You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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_infobefore 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.
The text was updated successfully, but these errors were encountered:
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 returningfalse
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'ssite_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'ssite_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 thesite_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 (untilsite_info
is set), then go back instead of it just not showing the page at all.The text was updated successfully, but these errors were encountered: