Skip to content
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(compiler-vapor): prevent v-for components from being single root #13149

Open
wants to merge 3 commits into
base: vapor
Choose a base branch
from

Conversation

runyasak
Copy link

@runyasak runyasak commented Apr 2, 2025

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 uses v-for, it should not be marked as a single root.

Scope of work

Added hasVFor check to detect components with v-for directives.

Example

<template>
  <Comp v-for="item in items" :key="item" />
</template>

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.

Copy link

netlify bot commented Apr 2, 2025

Deploy Preview for vapor-repl ready!

Name Link
🔨 Latest commit a951a73
🔍 Latest deploy log https://app.netlify.com/sites/vapor-repl/deploys/67edee9d95d178000815c802
😎 Deploy Preview https://deploy-preview-13149--vapor-repl.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@edison1105 edison1105 changed the title fix: prevent v-for components from being single root fix(compiler-vapor): prevent v-for components from being single root Apr 2, 2025
@edison1105 edison1105 added wait changes scope: vapor related to vapor mode labels Apr 2, 2025
@runyasak runyasak requested a review from edison1105 April 2, 2025 15:39
Copy link

pkg-pr-new bot commented Apr 3, 2025

Open in StackBlitz

@vue/compiler-core

npm i https://pkg.pr.new/@vue/compiler-core@13149

@vue/compiler-dom

npm i https://pkg.pr.new/@vue/compiler-dom@13149

@vue/compiler-ssr

npm i https://pkg.pr.new/@vue/compiler-ssr@13149

@vue/compiler-sfc

npm i https://pkg.pr.new/@vue/compiler-sfc@13149

@vue/compiler-vapor

npm i https://pkg.pr.new/@vue/compiler-vapor@13149

@vue/reactivity

npm i https://pkg.pr.new/@vue/reactivity@13149

@vue/runtime-core

npm i https://pkg.pr.new/@vue/runtime-core@13149

@vue/runtime-dom

npm i https://pkg.pr.new/@vue/runtime-dom@13149

@vue/runtime-vapor

npm i https://pkg.pr.new/@vue/runtime-vapor@13149

@vue/server-renderer

npm i https://pkg.pr.new/@vue/server-renderer@13149

@vue/shared

npm i https://pkg.pr.new/@vue/shared@13149

vue

npm i https://pkg.pr.new/vue@13149

@vue/compat

npm i https://pkg.pr.new/@vue/compat@13149

commit: a951a73

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: vapor related to vapor mode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants