Closed alkis05 closed 4 months ago
I've been thinking about this before.
It's a bit hard to do a full save operation: that will take a while for big projects.
Maybe it's an idea to build an event log and register all events that modify the model? We already do that for the undo functionality. If Gaphor crashes, we can replay the event log.
The only uncertainty is what happens if the event log cannot be fully replayed? Should it replay up to the point where it errors?
I've been implementing a little service in Gaphor that records all (model) changes.
Doing this adds hardly any overhead and all changes (in case of a crash or abrupt termination of Gaphor) can be replayed (it's re-using undo functionality to some extents).
The idea is that a user doesn't loose any work in case of a failure.
I see three approaches at this point:
For case 1 I created some screenshots.
NB. A delete button is missing on the "recover" rows.
I'm not sure if the difference between Recently Opened and Recover Models is clear. Maybe add them all to Recently Opened and add a note (with unsaved changes)
?
@danyeaw What do you think?
Hey @amolenaar, I really like your idea to integrate this with the current greeter! You also told me that you thought this might be getting too complex.
Since recovering from a crash should hopefully not be a frequent event, and because users should almost always want what they were working on back, what if we directly open the restored window?
@all-contributors please add @alkis05 for idea
@danyeaw
I've put up a pull request to add @alkis05! :tada:
Thanks @alkis05 for the enhancement request!
@amolenaar did a fantastic job implementing automatic recovery of unsaved changes, and it will be out in the next feature release soon.
Is your feature request related to a problem?
App crashed and lost a lot of work
Describe the solution you'd like
Of course I could save often, but it wouldn't heart to have a temporary file saved, say, after changing a diagram or something. This could be loaded in case the program closes for some reason before saving. At least offer the option for that. Like there is on text editors and many other tools.
Describe alternatives you've considered
Just remember to save often.
Additional context
Add any other context or screenshots about the feature request here.