fix(compiler-vapor): prevent v-for components from being single root #13149
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.
This PR is related to vuejs/vue-vapor#299.
Summary
This PR continues the work from vuejs/vue-vapor#305 to fix an issue where components with v-for directives were incorrectly marked as single root components in vapor mode.
Overview
As noted in the original PR, when a component has only a single root element, the fourth argument is included in
createComponent
. However, if there are multiple elements or if the component usesv-for
, it should not be marked as a single root.Scope of work
Added
hasVFor
check to detect components with v-for directives.Example
Now correctly compiles without marking the component as a single root.
Additional Notes
The previous PR in vue-vapor was closed as the work has moved to the vapor branch in the core repository. This PR implements the same fix but in the current development location.
If you have any feedback or suggestions, please let me know.