Auto-save idle delay?


#1

Hey folks, just starting to get into Glitch and it looks like I could have a lot of fun here. So far, a big thing I’d like to see is maybe a configurable delay for auto-save.

The auto-save feature is neat, and I can definitely see how it’ll be cool to have changes happen as close to live as possible. In fact, I started playing with Hot Module Reloading in webpack to see how editing in Glitch could feed into that.

It seems like as soon as I start typing one character, it saves many times over the course of trying to make an edit. This makes the file watcher in webpack churn with many rebuilds in quick succession - some of which work and some of which break the build (e.g. because I started typing a statement, but haven’t finished it)

And I might be wrong, but it seems like the quick successive builds kind of drags down the whole container - to the point that even the editor gets unresponsive sometimes and seems to disconnect.

It would be nice if a) the auto-save maybe waited for an idle period where I’d stopped typing for awhile and b) if that waiting period were configurable. So, say I start typing a JS expression, it would be great to have maybe a 1-2 second pause before saving happens.

Webpack also has an aggregateTimeout setting under watchOptions to delay builds after save. That helps, but it’s a race: the clock on that timer starts with the first save and not the final edit before an idle period.

I might also poke around with webpack some more, maybe see if I can make it build on a button-push from the app. That seems like a shame, though, since there’s a nice feedback loop with auto-save


#2

Another option that might be handy is to defer saving until I change files, or click onto another line in the file. Not entirely live, but maybe another useful cue that my edits are ready to commit.


#3

You can set a throttle value in a watch.json file in your project to configure a wait time between beginning to make a change and the change being applied, which might help you: https://glitch.com/faq#restart


#4

That doesn’t really help: The app (webpack-dev-server) doesn’t restart. In fact, I’ve got my watch.json set to have Glitch not restart that app unless webpack.config.json changes. All the other file changes are picked up by the running webpack file watcher.


#5

Still poking at this, but this seems like an improvement FWIW: Adding eslint-loader to my webpack config appears to buffer the most obvious typos and incomplete statements by not actually triggering hot module reload on file changes until the stuff looks valid.