Can't recover work lost by a reload

Open up the editor, then put a script in it. Reload, then check the file menu--no recover option.

Yeah, the recover option is there only if there's a previous saved version.

But if you realize you didn't save, and you don't edit another project, you can choose "Restore unsaved project" from the File menu.

I don't mean the Open...>Recover. What I mean is that if you lose work from a browser reload, that "Restore unsaved project" menu item does not appear.

I think I saw somewhere in the code that it was disabled, I don't know why though. Don't take my word for it, I don't really know if this is true.

When Things Slow Down™

I don't think it is, though I not quite sure either. (I did look in the code a little, but found nothing.)

huh, I just looked through the code (with a quick search for "diabled"), and it appears it isn't disabled. That's why I said, "Don't take my word for it".

@ bromagosa @jens

That's not a cloud feature, but a Snap! IDE feature that keeps your unsaved project to localStorage. I can't remember when it's triggered, though. Jens will know :slight_smile:

I do :slight_smile: It's triggered when you load another project without saving the current one.

that's right. How would we save anything for you if you decide to reload your browser tab? There is not hook to perform any action before the reload happens. But, you know, what do you think the following dialog wants to inform you about?

a) Changes you made may not be saved
b) Changes you made are saved

:smiley:

window.onbeforeunload

right, now read the spec.


yeah

it says you can show the reload confirmation prompt within the event handler, so i’d guess it is related to before the page reloads.

although sending data to the server is an asynchronous task, so i’m not sure if the page would begin reloading before it is complete.

I think it wouldn't send anything to the server, instead, save it to the localStorage

but you can while notComplete and block the main thread or just make it synchronous like false on 3rd param