Skip to content
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

Open
juliusknorr opened this issue Nov 6, 2024 · 3 comments
Open

Block closing/navigating away with unsaved changes #6606

juliusknorr opened this issue Nov 6, 2024 · 3 comments
Assignees

Comments

@juliusknorr
Copy link
Member

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.

@juliusknorr
Copy link
Member Author

@mejo- Assigned you as you mentioned you'd be up for looking into that

@github-project-automation github-project-automation bot moved this to 🧭 Planning evaluation (don't pick) in 📝 Office team Nov 6, 2024
@juliusknorr
Copy link
Member Author

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

@juliusknorr
Copy link
Member Author

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:

  • Create a file
  • Write something
  • Save
  • Write something more quickly, wait for a push to happen and force quit your browser tab
  • Reopen the file and see that the save indicator is not showing any unsaved changes, but the file content is still the old one

This is due to the dirty flag only changing once some more typing is happening

this.dirty = state.dirty

Example file has a last saved version of 128 but the first sync adds more steps:

Image

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:

$stepsVersion = $this->stepMapper->getLatestVersion($document->getId());

Something to think about how we can ensure to still save in such scenarios.

@juliusknorr juliusknorr moved this from 🧭 Planning evaluation (don't pick) to 📄 To do (~10 entries) in 📝 Office team Nov 18, 2024
mejo- added a commit that referenced this issue Dec 2, 2024
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📄 To do (~10 entries)
Development

No branches or pull requests

2 participants