Operations are being applied twiceSee original GitHub issue
When a character is typed into the editor, there are checks in place to determine whether that insertion was done by the local client or a remote one. This is so the sharedType observeDeep listener does not apply a change to a local client that the same local client just made. However, in version 2 or greater, I am seeing this exact issue happening. After a little investigation, I’ve verified that if-statements in the
sharedType.observeDeep callback and
e.onChange callback within the yjsEditor.ts file are both evaluating to true. This leads me to believe there is a bug with the new
WEAK_MAP implementation of this solution.
I will investigate further to try and find a fix, but will post this here in case someone finds it faster than me.
- Created 2 years ago
- Comments:11 (5 by maintainers)
Top GitHub Comments
I will try and post a repo that can reproduce the issue.
I see the duplicate operations in this example, but i can’t figure out why they appear. If slate was trying to apply the same insert_text op twice, it would insert two characters, but instead it has the correct state as i type. It’s as if the updates are applied to the wrong instance of the editor, a detached one, which would indicate a problem with the example rather than the library.
At any rate, i think this is a problem with the setup rather than slate-yjs, as we don’t have this problem and use slate-yjs in production.