Open bhousel opened 2 months ago
Is the purpose of this event to help us understand when someone leaves the site @bhousel?
Is the purpose of this event to help us understand when someone leaves the site @bhousel?
Yes - the "mutex" mentioned above is a trick that means that if you have multiple Rapid tabs open then only one of them will be allowed to backup the user's edits. When you close the tab, it releases that lock.
The whole thing is kind of messy and we should probably rethink how saving user's backups should work.
Thanks for clarifying. Sounds like pretty core functionality to avoid failure states and edit conflicts.
We use this event to release the localStorage mutex, but it seems like browsers are dropping support for it.
https://github.com/facebook/Rapid/blob/695d7f2fa93aaea4b98a2139157922956699fd8b/modules/core/EditSystem.js#L145
more info here https://developer.mozilla.org/en-US/docs/Web/API/Window/unload_event https://chromestatus.com/feature/5579556305502208