Make meteor return to Root URL on restart

For most of the time that I’ve used Meteor, whenever I need to reload it in the browser (or it reloads itself because it detects a file change), the app has returned to the root url (http://localhost:3000). Lately, it has stopped doing that and it tries to re-load the current URL (the current route, actually), like http://localhost:3000/Grid or something. Which usually make the whole program hang and I have to manually fix the URL in the address bar and then reload.

Could the router be causing this? I’m using Vue and the Vue router with Meteor. Any other ideas?

I dumped Bootstrap and the problem went away. ???

Installed Semantic-UI and the problem came back! What do these UI frameworks do that causes this?

Meteor has always remained on the URL I’m on after refresh for me, this is also usually the desired result. I’d be quite worried if a valid URL caused my site to hang - what would happen if someone actually refreshed their page while viewing /Grid?

Not sure why this would be related to bootstrap/semantic-ui

That might be something caused by redirections, probably you are checking if user has permissions or is logged in…, and when the page reloads something is not yet ready and it redirects to / or to other page.

Sound like that can be something you could check.

Good point @znewsham … it shouldn’t be hanging like this on a restart and here’s the code that should be preventing the problem, it’s inside the mounted hook where I create my Vue app instance:

  mounted() {

    if (this.$route.path !== '/') {
      this.$router.replace({ name:'Home' });

… but this code is not running on restart and formerly it did. This is a game that always starts with a “clean slate”. At this point, there’s no attempt to track where the user last was or what the variables were when they exited, etc., which is fine as long as you can do the redirect above. I may not be catching this route issue in the right way.

@pmogollon Thanks for mentioning redirects! That’s what caused me to find that router code that wasn’t running – and I changed the hook to be “created” from “mounted” … and that did the trick! Very much enjoying using Vue and Meteor together, but I’m still learning Vue …

1 Like