Skip to content

fix(compiler-vapor): handle template children in Transition#14606

Merged
edison1105 merged 4 commits intovuejs:minorfrom
jackma9604:fix/transitionTransition
Mar 20, 2026
Merged

fix(compiler-vapor): handle template children in Transition#14606
edison1105 merged 4 commits intovuejs:minorfrom
jackma9604:fix/transitionTransition

Conversation

@jackma9604
Copy link
Copy Markdown

@jackma9604 jackma9604 commented Mar 19, 2026

Problem Description

The program will report an error if there is a template tag inside Transition

Vue Version

3.6.0-beta.8

Link to minimal reproduction

Playground

Any additional comments

I don't know if it was intentional. but this is normal in VDOM mode.
I tried to fix it, If it's incorrect, please close this PR

Summary by CodeRabbit

  • Bug Fixes

    • Improved transition component handling with conditional templates and v-for directives; refined warning detection logic to provide more accurate feedback when using <transition> with template structures.
  • Tests

    • Added comprehensive test coverage for transition warning behavior with various template configurations, ensuring warnings are correctly emitted or omitted based on child element structures.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 19, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4d5a610b-e659-4dd3-bc1d-a1070d487add

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can suggest fixes for GitHub Check annotations.

Configure the reviews.tools.github-checks setting to adjust the time to wait for GitHub Checks to complete.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 19, 2026

Open in StackBlitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@14606
npm i https://pkg.pr.new/@vue/compiler-core@14606
yarn add https://pkg.pr.new/@vue/compiler-core@14606.tgz

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@14606
npm i https://pkg.pr.new/@vue/compiler-dom@14606
yarn add https://pkg.pr.new/@vue/compiler-dom@14606.tgz

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@14606
npm i https://pkg.pr.new/@vue/compiler-sfc@14606
yarn add https://pkg.pr.new/@vue/compiler-sfc@14606.tgz

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@14606
npm i https://pkg.pr.new/@vue/compiler-ssr@14606
yarn add https://pkg.pr.new/@vue/compiler-ssr@14606.tgz

@vue/compiler-vapor

pnpm add https://pkg.pr.new/@vue/compiler-vapor@14606
npm i https://pkg.pr.new/@vue/compiler-vapor@14606
yarn add https://pkg.pr.new/@vue/compiler-vapor@14606.tgz

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@14606
npm i https://pkg.pr.new/@vue/reactivity@14606
yarn add https://pkg.pr.new/@vue/reactivity@14606.tgz

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@14606
npm i https://pkg.pr.new/@vue/runtime-core@14606
yarn add https://pkg.pr.new/@vue/runtime-core@14606.tgz

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@14606
npm i https://pkg.pr.new/@vue/runtime-dom@14606
yarn add https://pkg.pr.new/@vue/runtime-dom@14606.tgz

@vue/runtime-vapor

pnpm add https://pkg.pr.new/@vue/runtime-vapor@14606
npm i https://pkg.pr.new/@vue/runtime-vapor@14606
yarn add https://pkg.pr.new/@vue/runtime-vapor@14606.tgz

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@14606
npm i https://pkg.pr.new/@vue/server-renderer@14606
yarn add https://pkg.pr.new/@vue/server-renderer@14606.tgz

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@14606
npm i https://pkg.pr.new/@vue/shared@14606
yarn add https://pkg.pr.new/@vue/shared@14606.tgz

vue

pnpm add https://pkg.pr.new/vue@14606
npm i https://pkg.pr.new/vue@14606
yarn add https://pkg.pr.new/vue@14606.tgz

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@14606
npm i https://pkg.pr.new/@vue/compat@14606
yarn add https://pkg.pr.new/@vue/compat@14606.tgz

commit: 041b2bf

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 19, 2026

Size Report

Bundles

File Size Gzip Brotli
compiler-dom.global.prod.js 86.4 kB 30.2 kB 26.6 kB
runtime-dom.global.prod.js 111 kB 41.9 kB 37.5 kB
vue.global.prod.js 170 kB 61.7 kB 55 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 50.6 kB 19.8 kB 18 kB
createApp 59.6 kB 23.1 kB 21 kB
createApp + vaporInteropPlugin 85 kB 31.4 kB 28.4 kB
createVaporApp 28.7 kB 11.1 kB 10.2 kB
createSSRApp 63.9 kB 24.8 kB 22.5 kB
createVaporSSRApp 31.9 kB 12.3 kB 11.3 kB
defineCustomElement 66.2 kB 25.1 kB 22.8 kB
defineVaporCustomElement 39.3 kB 14.5 kB 13.3 kB
overall 74.5 kB 28.4 kB 25.8 kB

@edison1105 edison1105 added the scope: vapor related to vapor mode label Mar 20, 2026
@edison1105 edison1105 changed the title fix(compiler-vapor): Transition accepts template tags fix(compiler-vapor): handle template children in Transition Mar 20, 2026
@edison1105
Copy link
Copy Markdown
Member

Thank you for your contribution, but it introduced some regressions, which I have fixed. See f99df63

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/compiler-vapor/src/transforms/transformTransition.ts (1)

56-57: Consider simplifying the redundant condition.

The condition (!isTemplateNode(c) || (isTemplateNode(c) && !hasMultipleChildren(c))) is logically equivalent to !isTemplateNode(c) || !hasMultipleChildren(c) since if the first operand is false, isTemplateNode(c) is necessarily true.

♻️ Suggested simplification
        c.type === NodeTypes.ELEMENT &&
-        (!isTemplateNode(c) ||
-          (isTemplateNode(c) && !hasMultipleChildren(c))) &&
+        (!isTemplateNode(c) || !hasMultipleChildren(c)) &&
        // not has v-for
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/compiler-vapor/src/transforms/transformTransition.ts` around lines
56 - 57, The boolean expression in the condition is redundant: replace the
current check `(!isTemplateNode(c) || (isTemplateNode(c) &&
!hasMultipleChildren(c)))` with the simplified equivalent `!isTemplateNode(c) ||
!hasMultipleChildren(c)` to remove the unnecessary repeated call to
isTemplateNode; update the expression wherever it appears (e.g., in the
conditional that references isTemplateNode and hasMultipleChildren for node
variable c) to improve readability and performance.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/compiler-vapor/src/transforms/transformTransition.ts`:
- Around line 56-57: The boolean expression in the condition is redundant:
replace the current check `(!isTemplateNode(c) || (isTemplateNode(c) &&
!hasMultipleChildren(c)))` with the simplified equivalent `!isTemplateNode(c) ||
!hasMultipleChildren(c)` to remove the unnecessary repeated call to
isTemplateNode; update the expression wherever it appears (e.g., in the
conditional that references isTemplateNode and hasMultipleChildren for node
variable c) to improve readability and performance.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c077ce9c-4987-40b9-8532-79df5c7bf114

📥 Commits

Reviewing files that changed from the base of the PR and between c245dae and f99df63.

📒 Files selected for processing (2)
  • packages/compiler-vapor/__tests__/transforms/TransformTransition.spec.ts
  • packages/compiler-vapor/src/transforms/transformTransition.ts

@edison1105 edison1105 merged commit 5fb8b33 into vuejs:minor Mar 20, 2026
14 of 15 checks passed
@jackma9604 jackma9604 deleted the fix/transitionTransition branch March 20, 2026 10:02
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