question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Operations are being applied twice

See 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.

image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
chasefarmer2808commented, Jul 12, 2021

I will try and post a repo that can reproduce the issue.

0reactions
nemanja-tosiccommented, Aug 23, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found