hocuspocus icon indicating copy to clipboard operation
hocuspocus copied to clipboard

Maxdebounce causing client-id to change

Open felixrydberg opened this issue 7 months ago • 0 comments

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

  1. Setup a multiplex environment.
  2. Load a subdoc to your main doc
  3. Make a change to the ydoc shared states (I have used the tiptap editor)
  4. Unload the page and within the maxdebounce time load it again
  5. 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

felixrydberg avatar Jul 16 '24 19:07 felixrydberg