-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow web IDE to save and/or show warning before navigating away from page (eg. refresh) #78
Comments
Done, it now saves and shows a prompt for 5s when loading the site |
@j4k0xb That is pretty cool! A few notes:
Also did a little code review with some thoughts/notes added there: |
@j4k0xb Awesome!
@j4k0xb nods sounds good. I agree that that feels like a better UX as well. Maybe instead of just saving the files 'as is', there could be some notion of like a 'session' or similar that they get saved into? Not sure if this is overengineering it, but was sort of thinking in terms of thinking a bit like Chrome tab history/restore/similar. Like, a completely arbitrary off the top of my head example could be that when the web app loads, it creates a UUID for that current session, and then any files that are written to storage are keyed with that UUID (and probably a 'last updated' timestamp; perhaps for the session overall, and the file). Then in the 'restore UI', it could show the last X sessions (sorted by timestamp); or something to that effect. (With this, was mostly thinking that since the 'restore state' is going to persist longer than 5sec now; it might make sense to try and scope/group the 'files' a bit more 'logically'; so that a new session doesn't inadvertently wipe out the old one) |
Just had a chance to quickly test this now that #79 has landed. Trying to refresh the page (with unsaved content): Trying to navigate away from the page (with unsaved content): If I do reload/navigate away, when I come back, I can attempt to restore from the 'File' -> 'Open Recent' menu:
But when I clicked on it, it didn't seem to actually restore the item at all. |
It would be cool if the web IDE allowed us to save to browser storage, or at the very least showed a popup/confirmation if we try to navigate away from /refresh the page while working on something.
I'm not sure why my muscle memory was doing it, but I kept hitting cmd+R to try and rename variables yesterday, and lost my in-progress work like 5 times before I managed to force myself to stop pressing it.
Potentially relevant:
The text was updated successfully, but these errors were encountered: