-
Notifications
You must be signed in to change notification settings - Fork 94
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
Block closing/navigating away with unsaved changes #6606
Comments
@mejo- Assigned you as you mentioned you'd be up for looking into that |
Might be an interesting read for checking if there are options to still persist on unload: https://www.speedkit.com/blog/unload-beacon-reliability-benchmarking-strategies-for-minimal-data-loss |
Another thing I noticed is that when reopening such a document with unsaved changes the autosave would not happen as the frontend does not notice unsaved changes. Easy steps to reproduce:
This is due to the dirty flag only changing once some more typing is happening text/src/components/Editor.vue Line 657 in e67590a
Example file has a last saved version of 128 but the first sync adds more steps: I think we used to check the saved version against current version but we no longer pass the current version at load time to the frontend: text/lib/Service/DocumentService.php Line 125 in 3238541
Something to think about how we can ensure to still save in such scenarios. |
…load Try to send a save request on unsaved changes on `beforeunload` event, which happens e.g. when the tab/browser gets closed. Fixes: #6606 Signed-off-by: Jonas <jonas@freesources.org>
After discussion with @mejo- it could be worth to implement a method in beforeunload to check and block navigating away with unsaved local changes.
Could prevent diverging y.js state and markdown state on the server and also make us aware if there are any saving issues that currently are left unseen.
The text was updated successfully, but these errors were encountered: