-
-
Notifications
You must be signed in to change notification settings - Fork 5
Description
For your information: this is an inconsistency in the code I noticed, and I have not run the code to work this out. Nevertheless, I think and hope the report will be useful (and I'm not misinterpreting the code); I will keep it brief.
Checklist
- Are you reporting a bug? Use github issues for bug reports and feature requests. For general questions, please use https://discuss.yjs.dev/
- Try to report your issue in the correct repository. Yjs consists of many modules. When in doubt, report it to https://github.com/yjs/yjs/issues/
Describe the bug
The code adds a handler to remove its awareness state on the browser window beforeunload event, but not when the Node.js process is ended. According to the last bullet point in the first list in its README y-dat supports "both node and the browser" so I would expect both handlers. Here is the current browser-only code:
Lines 258 to 262 in 745d25f
| if (typeof window !== 'undefined') { | |
| window.addEventListener('beforeunload', () => { | |
| awarenessProtocol.removeAwarenessStates(this.awareness, [doc.clientID], 'window unload') | |
| }) | |
| } |
To Reproduce
N/A
Expected behavior
The code should probably add an 'exit' handler to process if it exists, to close the connection at the end when run in Node.js, like in y-webrtc:
Screenshots
N/A
Environment Information
N/A
Additional context
N/A
- I'm a sponsor 💖
- This issue is a blocker for my project.