-
-
Notifications
You must be signed in to change notification settings - Fork 232
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
Yjs extension leaks yjs UndoManager
instances when editor re-renders
#1448
Labels
type: bug 🪲
Something isn't working
Comments
I don't know much about YJS, but I'd like to merge it if you can submit a PR to Remirror. (I can take care of the updating y-prosemirror dependency) |
ankon
added a commit
to ankon/remirror
that referenced
this issue
Jan 4, 2022
ankon
added a commit
to ankon/remirror
that referenced
this issue
Jan 4, 2022
4 tasks
See #1457 for a proposed fix (basically a merge of our changes + two tests) |
ankon
added a commit
to ankon/remirror
that referenced
this issue
Jan 4, 2022
ankon
added a commit
to ankon/remirror
that referenced
this issue
Jan 4, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
Yjs extension leaks yjs
UndoManager
instances when the editor re-renders:yUndoPlugin
instance as part of its "external" plugins (remirror/packages/remirror__extension-yjs/src/yjs-extension.ts
Lines 173 to 198 in 963a1ed
yUndoPlugin
creates a new YjsUndoManager
instance in it'sinitState
callback (https://github.com/yjs/y-prosemirror/blob/039be96fb520e972fa37f0e896b585ef19da1beb/src/plugins/undo-plugin.js#L35-L48)UndoManager
attaches itself to the document'safterTransaction
event (https://github.com/yjs/yjs/blob/645f05b0bb2435552582f587f5379c33adda6ffe/src/utils/UndoManager.js#L166)useReactFramework
hook:remirror/packages/remirror__react-core/src/hooks/use-react-framework.tsx
Lines 43 to 45 in 963a1ed
Steps to reproduce
sandbox TBD, basically:
Expected results
Everything is happy.
Actual results
Y.Doc
instance slowly collects moreafterTransaction
handlersPossible Solution
y-prosemirror allows to provide a undo manager. We have forked the remirror yjs extension again to do that, see Collaborne/remirror-extension-yjs@7c77917 for the commit.
In remirror "proper" you will have to update the y-prosemirror dependency to at least 1.0.14 to include yjs/y-prosemirror#87, due to historic reasons we use our own y-prosemirror and basically merged that PR.
The text was updated successfully, but these errors were encountered: