fix: configure should use the parent of the current instance, to avoid duplication #5147
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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