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.