-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Preserve empty parent during replacement #3595
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
LGTM. Accepting to unblock, but maybe @trueadm would have the best insights here.
It would probably break some things, but I'm still personally of the opinion that this behavior should be the default. It's not intuitive that removing a specific node would also sometimes remove it's parent. At the same time, it is convenient to not have to check emptiness on your own every time you remove a node. |
Pure removal might require parent cleanup but as a part of replacement it does not make much sense |
894ac17
to
4417569
Compare
When node is being replaced we should preserve its empty parent (in case it has
canBeEmpty: false
), as otherwise parent might be deleted and replacement fail. E.g., LinkNode hascanBeEmpty: false
and attempting to replace its text node child would fail.Will add test, want to see CI results in case I've missed anything