-
-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
yCursorPlugin exception when ySyncPlugin not initialized #156
Comments
Thanks! I added a fix. This will be part of the next release. |
@dmonad Thank you! If you're touching this part of the code anyway, there is a similar null-check here y-prosemirror/src/plugins/cursor-plugin.js Line 207 in f41a3e1
If I got the root cause right, the check is a no-op Leaving it in won't cause problems because absolutePositionToRelativePosition has a built-in way to handle an empty map Line 82 in f41a3e1
...but you may want to remove or change it anyway? |
Hello @dmonad
I'm using y-prosemirror through Tiptap and I've checked they are using the lastest version 1.2.9. |
As above, we're also using y-prosemirror through tiptap and are on 1.2.9 and still experiencing this error |
Any update on this? |
The fix is released in y-prosemirror@1.2.10. Please make sure to use the latest version and fill out the issue template when you open another ticket. |
Issue
I'm using ySyncPlugin and yCursorPlugin together, to keep my editor up-to-date and to share cursor information through awareness. Sometimes, when a client is already connected to the same room and sharing their cursor position, trying to connect with a second client causes an exception
The exception happens because
ystate.binding.mapping
is an empty map before ySyncPlugin finishes initializing, andrelativePositionToAbsolutePosition
expects a full and initialized map.Workaround
I've fixed the issue for myself by patching
cursor-plugin.js
This seems like the right thing to do because the null check will never return true. The null check was originally added in 1.1.3, when ySyncPlugin initialized binding to
null
. This was changed very recently in 1.2.7 - ySyncPlugin now initializesbinding
tonew ProsemirrorBinding
, so binding is nevernull
.Environment Information
I'm using y-prosemirror through Remirror, but am unaffected by #155 because my app waits until Y.Doc is loaded before loading ySyncPlugin
I'm using Liveblocks as the provider.
The text was updated successfully, but these errors were encountered: