PMunch / nim-playground-frontend

The front-end for https://play.nim-lang.org
45 stars 16 forks source link

Preventing loss of work #21

Open exelotl opened 3 years ago

exelotl commented 3 years ago

Earlier I was doing some experiments in the playground for about an hour, then at some point when I tried to run my code, the connection between Cloudflare and the playground failed and I lost my work. Also, there have previously been occasions where I shut down my computer and forgot to copy my code out of the playground, and wished I was able to get that code back.

I would suggest just letting the browser remember the form field (as it does on github issues, for example) but I guess that's not how the CodeMirror editor works?

A possible solution would be to implement a history panel that keeps your past work in localStorage? Opening the playground in a new browser tab would add a new entry to the history. Changes to the entry would be saved at regular intervals, and when running the code, and whenever leaving/closing the page.

insomniacUNDERSCORElemon commented 2 years ago

I don't know how viable it is, but maybe don't refresh the page if the server is down. Or don't swap over until/unless the new version is loaded... unless it can be reworked to not refresh the page (aside from the output) at all.