-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[@lexical/utils] Bug Fix: cursor positioning issue with CJK #6947
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
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.
I think you're right that this updateDOM call doesn't really make sense. What updateDOM does is return true if the node should be re-mounted, otherwise it returns false and does some in-place mutations (which is what is likely causing the issues here). If it would've returned true you can detect that because that DOM would be unmounted and createDOM would be called to create a new one so currentAnchorNodeDOM !== previousAnchorNodeDOM would be true. I think the proper fix would be to track those previous DOM variables in the closure outside of the compute function just like previousAnchorNode and previousFocusNode. This way the updateDOM call can be eliminated but the intent of that check can be preserved.
/cc @zurfyx
@mrdivyansh I created a draft PR #6961 with what I think this should look like, but I can't easily repro this bug so if you could take a look that would be great |
Description
It fixes #6946. However, I am not sure why TextNode.updateDOM should cause any side-effect.
Closes #6946