-
Notifications
You must be signed in to change notification settings - Fork 110
Fix: initialize undomanager for empty document #7962
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
base: main
Are you sure you want to change the base?
Conversation
07762fd to
54f60f9
Compare
| }, | ||
| initUndoManagerForEmptyDocument() { | ||
| if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something that gets added to the history and pushing steps to the server? As discussed I'd be fine with this as a workaround but we should file an upstream issue at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@juliusknorr I clear the history after deleting the space, and in my test there were no steps added to the database in this process. I agree that an upstream issue for yjs should be created and this workaround should be removed once the issue is fixed or a better workaround is found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, would be fine with me then.
However tests seem to fail quite heavily. Maybe it has some unexpected side effects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some failing tests, such as the ones counting characters seem to be timing-related and caused by this change. Making the tests even more flaky with this workaround doesn't seem ideal. Maybe we should discuss and explore an alternative less invasive workaround for this.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Signed-off-by: Benjamin Frueh <benjamin.frueh@gmail.com>
54f60f9 to
cff9c03
Compare
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
The first paste action in an empty document was not being tracked by the Yjs UndoManager, making it impossible to undo and not tracking it as a change.
This adds initUndoManagerForEmptyDocument() which primes the undo manager by inserting and deleting a space, then clearing the undo stack. This ensures user actions are properly tracked.