-
-
Notifications
You must be signed in to change notification settings - Fork 147
Description
Please save me some time and use the following template. In 90% of all issues I can't reproduce the problem because I don't know what exactly you are doing, in which environment, or which y-* version is responsible. Just use the following template even if you think the problem is obvious.
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
This bug is an edge case where an inline atom node is selected by Client A will throw an error and reject the document change when Client B removes that node.
The reason why this happens is, because the NodeSelection class constructor assumes that nodeAfter will exist on the resolved position which it usually does in cases where the resolved position points between nodes in block level nodes. (See here).
However when you have an inline atom node, that is inside a paragraph, this logic can fail because in this case the resolved position won't point to the doc and in between block level nodes but will point inside the now empty paragraph node.
When this happens, nodeAfter is null on the resolved pos and the constructor will throw an error and the content will be rejected from Client A.
To Reproduce
Steps to reproduce the behavior:
- Create a schema with an inline atom node (not verified if it only happens for atom nodes though)
- Create a document with said node inside a paragraph
- Client A selects the custom node, Client B deletes the custom node
- Client A's runtime will now throw an error because
nodeAfteris undefined and the content change is rejected on Client A's side.
Expected behavior
The content should not be rejected and the selection should fall back to a TextSelection.
Screenshots
N/A
Environment Information
- Google Chrome & Firefox - all up to date
- Sadly I don't have information about the exact yjs and y-prosemirror versions being used.
Additional context
Add any other context about the problem here.
- I'm a sponsor 💖 (via https://github.com/ueberdosis)
- This issue is a blocker for my project.