jedfoster / SassMeister

The Sass playground
http://sassmeister.com
199 stars 25 forks source link

Do not accept compilation results from previous requests when there's a more recent request pending #71

Closed lolmaus closed 10 years ago

lolmaus commented 10 years ago

There's an issue with AJAX that has become apparent thanks to status display.

Every edit you make is sent to the server for compilation and then is returned and displayed. When compilation takes less than a second, it's fine.

But when you have a heavy piece of Sass that take like five seconds to compile (example) and type more code, you see compiled results appearing with the five-second lag.

You start typing a line, the code with the unfinished line is sent for compilation. You finish typing the line, it is sent for compilation, then the result for the previous compilation returns and appears. You see a syntax error while your code is perfectly valid.

Worst of all, compilation result from the previous request resets the status notification and make you think that no compilation is pending. But then suddenly your output is updated.

Proposal: every new compilation request should cancel all previous requests. SassMeister should not display compilation results of previous requests when there's a more recent request pending.

jedfoster commented 10 years ago

This should be fixed with c03947d. Using your example, changing $grids to something like 55, waiting for "Compiling" to appear, and then changing back to 5 feels like it's behaving the way you want it to.

lolmaus commented 10 years ago

Thank you @jedfoster, is it live?

jedfoster commented 10 years ago

Yes.

lolmaus commented 10 years ago

Seems to work fine! Thank you!