-
-
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
y-prosemirror fires two updates for each change #121
Labels
bug
Something isn't working
Comments
This issue should share the same underlying reason as #113 |
ocavue
added a commit
to team-reflect/y-prosemirror
that referenced
this issue
Jun 17, 2022
This is a temporary patch for yjs#121
+1 - It appears now that due to the same commit, NodeSelections are converted to TextSelections anytime the document changes, as the |
jamesopti
referenced
this issue
Jun 20, 2022
Any updates on this one? |
Fixed and released 👍 |
Amazing! Thank you. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Checklist
Describe the bug
After updating y-prosemirror from 1.0.20 to 1.1.0, every keypress will trigger the
update
method for every plugin twice. This causes a lot of issues if a plugin want to compare the current state with the prev state.To Reproduce
I wrote a minimal reproduction to show this issue. In this example, I have a ProseMirror plugin to show whether or not the cursor is changed in the last operation. The code of this plugin is in
prosemirror.ts
.Is your cursor changed? true
. While in the 1.1.2 window, you will seefalse
.Expected behavior
Every keypress will only trigger one plugin update, as what we used to have in y-prosemirror 1.0.20
Screenshots
https://share.cleanshot.com/NJlBDh
Additional context
In commit 2d06ece,
pluginState.doc.transact
was added insidesyncPlugin
'supdate
function. CallingpluginState.doc.transact
will trigger_typeChanged
because it has been observed.tr.replace
will be called in_typeChanged
, which causes the second update.The text was updated successfully, but these errors were encountered: