y-prosemirror icon indicating copy to clipboard operation
y-prosemirror copied to clipboard

Prevent infinite cursor awareness update loop

Open furkan3ayraktar opened this issue 2 years ago • 2 comments

If two editors are open for the same Y.Doc, the cursor awareness state enters into an infinite update loop. This commit fixes the issue by using the solution suggested in this issue.

We've been using this solution for the last one and half years in production without any issues. I remembered it when receiving a recent notification from the issue and wanted to share the solution as a PR.

furkan3ayraktar avatar Oct 12 '23 14:10 furkan3ayraktar

I have tested this solution and though it fixes the main problem I have noticed that after switching a tab (focusout event), the cursor of the user (which switches the tab) is blinking for a moment. When we don't register focusout listener then this problem is solved but I don't know if it introduces other issues or not.

szymonkozak avatar Dec 12 '23 20:12 szymonkozak

I used pnpm patch to apply this PR and it fixed infinite loops when using awareness with tiptap with y-websocket-server, but the infinite loop still happens with hocuspocus.

garth avatar Jan 10 '24 18:01 garth