Unable to Disable Refresh App on Changes

capture

This image shows the current setting for Refresh App on Changes.

When off, it keeps restarting my app whenever I type something and it saves.
When on, it obviously does what it’s supposed to do.

Can you fix this?

That’s strange because it works perfectly fine for me! If you’re having problems with project restarting, you could use a watch.json, found at https://glitch.com/edit/#!/watch-json?path=watch.json:1:0. Just copy the contents of watch.json in the project (the link of which I have now given) and create a new file called watch.json in your project and paste it. The README of the file says it all:

Add a file called watch.json to your app, and the settings it contains will override the default install and restart trigger files and timings on Glitch.

This means that you can specify which files trigger a container restart or install when edited, as well as change the delay time between making edits and those changes being applied.

In the watch.json file, using regexp, you need to define a list of rules telling the container which files to include and exclude from being able to trigger install or restart commands.

The following JSON for example, tells the container to trigger a restart if any .js , .coffee or .json file is edited, but only if they aren’t within directories called public or dist .

"restart": {
    "exclude": [
      "^public/",
      "^dist/"
    ],
    "include": [
      "\\.js$",
      "\\.coffee$",
      "\\.json"
    ]
  }

The throttle time specifies the time to wait after a change began to happen and when that change is applied. It currently only affects server-side events. So for example, the following tells the container to apply changes after 10,000 milliseconds, or 10 seconds:

"throttle": 10000

Hope this helps! Also, @glitch_support will be notified about this problem!

2 Likes

This is also not working for me either. I have tried using a browser other than Google Chrome, but I had no success with that. It worked fine after adding a watch.json file as suggested, though I’d like to see this feature do what it’s intended to do.

I’d also like to note that it doesn’t refresh when changes are made to files of all types, but the option suggests it should.

2 Likes

In the watch.json, in the "include": part, add all the file extensions that you want to force restart on.

2 Likes

Sorry if it wasn’t clear, but I meant that the refresh on changes option doesn’t refresh on changes for all files. The name of that option just suggests it’ll refresh when changes are made to any file, and I can’t find anywhere where it says specifically that it’s not meant to.

I know I could use the watch.json file to achieve this, but I just wanted to point out that the default behaviour seemed a bit odd - if I was just editing a webpage then I’d have to manually refresh it myself.

1 Like

Hi @Aaron thanks for the feedback on the “Refresh App on Changes” option! I will share it with our team.

If you would like to discuss this further, the feedback topic would be a great place. Our team regularly reviews the posts in that channel and may reach out to you there if they have any questions.

1 Like