hocuspocus
hocuspocus copied to clipboard
Maxdebounce causing client-id to change
Description When loading and unloading ydocs within the maxdebounce timeslot yjs changes the client-id. This will cause the next ydoc unload to fail. This only happens when the client that loads the ydoc has made changes before closing it. Loading and unloading without making changes works fine.
Steps to reproduce the bug
- Setup a multiplex environment.
- Load a subdoc to your main doc
- Make a change to the ydoc shared states (I have used the tiptap editor)
- Unload the page and within the maxdebounce time load it again
- Unloading should fail with this message:
runtime-core.esm-bundler.js:265 Uncaught TypeError: Cannot read properties of undefined (reading 'clock')
at encodeAwarenessUpdate (awareness.js:201:78)
at AwarenessMessage.get (AwarenessMessage.ts:27:25)
at new MessageSender (MessageSender.ts:13:33)
at HocuspocusProvider.send (HocuspocusProvider.ts:452:27)
at HocuspocusProvider.disconnectBroadcastChannel (HocuspocusProvider.ts:580:12)
at HocuspocusProvider.disconnect (HocuspocusProvider.ts:386:10)
at HocuspocusProvider.destroy (HocuspocusProvider.ts:515:10)
Expected behavior Client-id should not be changed.
Screenshot, video, or GIF If applicable, add screenshots to help explain your problem.
Environment?
- operating system: Windows 11
- browser:
- mobile/desktop: Desktop
- Hocuspocus version:
- Server: 2.13.5
- Provider: 2.13.2
Additional context There is a workaround for this, just decrease the maxdebounce config