-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
fix: configure should use the parent of the current instance, to avoid duplication #5147
Conversation
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Nice and easy fix. looks good to me!
I think it's same for Nodes and Marks? |
Ah jeez, I missed that. I spent so much time trying to understand it I didn't realize it. Will follow up in another PR @634750802 |
Changes Overview
Based on the approach taken by #5136 and validated for appropriate behavior with a barrage of tests.
The gist of what is happening here is that
extend()
will always set the new child'sparent
property to bethis
(establishing a child -> parent relationship).When doing
.configure()
it is doing a.extend()
. Doing this directly on an extension (i.e. one that is not already.extend
'd), as it will create a child -> parent relationship with pretty much the exact same config so it ends up overwriting itself with it's same options.But what we really want is not a child -> parent relationship, but to just overwrite some options while maintaining an effective "copy" of the child (i.e. preserving it's child -> parent relationship).
This is pretty complicated, so I'm going to add a diagram explaining the current behavior and desired behavior here:
There was a lot of digging for this one:
It should resolve:
It may resolve:
Implementation Approach
Someone had implemented this already: #5136
I just validated that it worked and made sense with a barrage of tests. The root behavior I was trying to fix was #4704
Testing Done
Most of the code was adding tests to make sure that I understood what the problem was and if it fixed it.
Verification Steps
Run the tests with the
Extension.ts
file as it was before and note the tests that it fails to pass now without itAdditional Notes
Checklist
feat: Implement new feature
orchore(deps): Update dependencies
)Related Issues