Shouldn't it be just unload. beforeunload is often used to ask users about unsaved changes. It means that the user will be "disconnected" from the awareness protocol until they choose, for example, "exit without saving", "cancel" or "save".
Huly®: YJS-530