fix(find): allow finding stubs by stub definition #1113
Merged
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.
Long-long ago, in the galaxy far-far away it started pretty simple: we've passed a stub for a component and VTU rendered this stub via
transformVNodeArgs
provided by Vue core:We were able to find stub by stub (obviously, because VNode matched) and component by stub because we've tracked relation between component and it's stub (blue line)
Unfortunately, soon we've discovered that sometimes people use same stub for stubbing multiple components:
This was a problem, because we were unable to tell, if
Stub 1
was the stub ofOriginal component 1
orOriginal component 2
So, we've introduced a "specialized stub" concept - it is simply a copy of original stub, so for each original component stub is "unique":
We were still tracking relation between specialized stubs and original components (red dotted line) to keep everything consistent.
Unfortunately, this broke use case, when people are searching stubs by passing stub as component - if stub has no name, it will not match anything (and it worked in VTU v1). So this PR is pretty simple: it adds tracking relations between specialized stubs and stubs too, so we could match specialized stubs when searching for stubs (green dotted line):