`watch.json` is NOT good enough — Disable website redirection with each key press!


#1

Yes, this:

{
  "restart": {
    "exclude": [
      "^views/"
    ],
    "include": [
      "^server\\.js$"
    ]
  },
  "throttle": 100
}

Will stop the http server completely restarting when editing files in views/.

However, Glitch still refreshes the web page as typing happens, and this “refresh” isn’t really a refresh because it takes the web page back to the root of the site…

So, if you’re editing a file like views/should-stay-here-on-edit.html in this project:

While you have a browser tab pointed to:

https://watch-json-is-broken.glitch.me/should-stay-here-on-edit

ANY keypress editing should-stay-here-on-edit.html redirect that browser tab to:

https://watch-json-is-broken.glitch.me

Needless to say, this is REALLY annoying behavior, and I was just wondering if there was a way to disable it.

The only solution I can think to implement is redirect history-1 in the clientside javascript for the index page, if that history item would be in the same domain. This would be really hacky!!! :smiley:

Hopefully I missed something, and it’s easy to fix or turn off this behavior on my end?

Really, though, it seems like Glitch shouldn’t behave like this in the first place. I could understand a simple refresh that maintains the same page URL, but a redirect to index seems to defeat the purpose, especially when the web server reloading has been explicitly disabled for a particular file. Please help!


#2

You can uncheck ‘refresh app on changes’ in the top-right user preference menu, or just open the url in a new tab rather than via ‘Show’. Neither will then reload automatically, so it’d be up to you to refresh the page to see changes.


#3

THANK YOU!

For whatever reason these options were not obvious to me!!!

Perhaps a message like:

console.log('Glitch automatically refreshed this page. You can disable refresh in user settings');

Would have helped me wasting time on this!

I also read through the entire FAQ, so perhaps an entry there next to https://glitch.com/faq#console-files would have helped as well!


#4

Yes, good call. I’ll make sure to add it to the FAQ.