Operations are being applied twice
See original GitHub issueWhen 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.
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
What's the word for an operation that can be applied multiple ...
You might be thinking of "Idempotent". Idempotence is the property of certain operations in mathematics and computer science, that they can be applied...
Read more >Idempotence - Wikipedia
Idempotence is the property of certain operations in mathematics and computer science whereby they can be applied multiple times without changing the result ......
Read more >Group Policies being applied twice - TechNet
I've had a strange situation where I run the gpresult /r function from the command line and see that my user side group...
Read more >Do operations involving doubles take twice as long as ... - Quora
The single-precision instructions (and there are two of them!) take 19 cycles before the answer is ready, while the double-precision instructions take 34 ......
Read more >np.vectorize() functions operate twice on the first element (as ...
Now modify the dictionary and see that the function is applied twice to the first element: def fcn2(x): x['b'] += 1 return x['b']...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.