Skip to content

fix(runtime-vapor): support vdom slot content in Transition - #15159

Merged
edison1105 merged 14 commits into
minorfrom
edison/fix/vdom-slot-transition
Jul 28, 2026
Merged

edison1105 merged 14 commits into
minorfrom
edison/fix/vdom-slot-transition

Conversation

@edison1105

@edison1105 edison1105 commented Jul 25, 2026 •

Copy link
Copy Markdown
Member

Closes #15155

Resolve VDOM slot output using the same child selection and transition hook preparation as BaseTransition. Prepare both the incoming and previously rendered branches so enter and leave transitions work correctly, including keyed fragment identity.

Hydrate the resolved physical branch while preserving slot scope IDs and the surrounding insertion anchor.

Summary by CodeRabbit

  • New Features
    • Enhanced Vapor Transition/TransitionGroup and VDOM slot interop, improving slot fallback handling and coordination in both out-in and in-out modes.
  • Bug Fixes
    • Fixed transition sequencing and DOM/class behavior during deferred leaves/enters, keyed fragment swaps, and mid-transition slot switching, including hydration scenarios.
    • Improved reliability of fallback insertion/removal so the correct content shows at the right time.
  • Tests
    • Expanded Transition, TransitionGroup, and hydration coverage, adding cases for slot fallback vs VDOM content timing and DOM correctness.

Resolve VDOM slot output using the same child selection and transition hook
preparation as BaseTransition. Prepare both the incoming and previously
rendered branches so enter and leave transitions work correctly, including
keyed fragment identity.

Hydrate the resolved physical branch while preserving slot scope IDs and
the surrounding insertion anchor.
@coderabbitai

coderabbitai Bot commented Jul 25, 2026 •

Copy link
Copy Markdown

Review Change Stack

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: f21ecb8d-4cc0-48bb-a14b-f4c22d33e1ce

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)
📝 Walkthrough

Walkthrough

Changes

The PR extracts reusable transition child and branch preparation helpers from BaseTransition, exports them through runtime-core, and applies them to Vapor VDOM slot hydration and update paths. New tests cover enter, leave, keyed fragments, and hydration.

VDOM slot transition interop

Layer / File(s) Summary
Core transition helper extraction
packages/runtime-core/src/components/BaseTransition.ts, packages/runtime-core/src/index.ts
Transition child selection, branch preparation, hook resolution, and delayed-leave handling are centralized and exported.
Vapor slot transition rendering
packages/runtime-vapor/src/vdomInterop.ts
Hydration, refresh, patching, vnode tracking, and slot-scope forwarding use transition-prepared slot subtrees.
Interop transition validation
packages/runtime-vapor/__tests__/components/Transition.spec.ts, packages/runtime-vapor/__tests__/hydration.spec.ts
Tests verify slotted VDOM enter/leave classes, keyed fragment identity, and hydration leave behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant VDOMSlot
  participant VaporTransition
  participant RuntimeCore
  participant DOM
  VDOMSlot->>VaporTransition: render slotted VDOM content
  VaporTransition->>RuntimeCore: prepare transition branch
  RuntimeCore-->>VaporTransition: return inner vnode and hooks
  VaporTransition->>DOM: hydrate or patch prepared subtree
  DOM-->>VaporTransition: retain transition classes during enter/leave
Loading

Possibly related PRs

Suggested labels: scope: transition, scope: vapor, scope:hydration, interop

Suggested reviewers: danielroe

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes directly address #15155 by enabling Vapor to animate VDOM slot content and preserve leave behavior.
Out of Scope Changes check ✅ Passed The added exports, hydration updates, and tests all support the slot-transition fix and don't appear unrelated.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: enabling VDOM slot content support in Vapor Transition.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch edison/fix/vdom-slot-transition

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

@pkg-pr-new

pkg-pr-new Bot commented Jul 25, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@15159
npm i https://pkg.pr.new/@vue/compiler-core@15159
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@15159
npm i https://pkg.pr.new/@vue/compiler-dom@15159
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@15159
npm i https://pkg.pr.new/@vue/compiler-sfc@15159
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@15159
npm i https://pkg.pr.new/@vue/compiler-ssr@15159
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-vapor

pnpm add https://pkg.pr.new/@vue/compiler-vapor@15159
npm i https://pkg.pr.new/@vue/compiler-vapor@15159
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@15159
npm i https://pkg.pr.new/@vue/reactivity@15159
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@15159
npm i https://pkg.pr.new/@vue/runtime-core@15159
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@15159
npm i https://pkg.pr.new/@vue/runtime-dom@15159
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/runtime-vapor

pnpm add https://pkg.pr.new/@vue/runtime-vapor@15159
npm i https://pkg.pr.new/@vue/runtime-vapor@15159
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@15159
npm i https://pkg.pr.new/@vue/server-renderer@15159
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@15159
npm i https://pkg.pr.new/@vue/shared@15159
yarn add https://pkg.pr.new/@vue/[email protected]

vue

pnpm add https://pkg.pr.new/vue@15159
npm i https://pkg.pr.new/vue@15159
yarn add https://pkg.pr.new/[email protected]

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@15159
npm i https://pkg.pr.new/@vue/compat@15159
yarn add https://pkg.pr.new/@vue/[email protected]

commit: b50a755

@github-actions

github-actions Bot commented Jul 25, 2026 •

Copy link
Copy Markdown

Size Report

Bundles

File Size Gzip Brotli
compiler-dom.global.prod.js 87.1 kB 30.5 kB 26.8 kB
runtime-dom.global.prod.js 115 kB (+563 B) 43.2 kB (+180 B) 38.7 kB (+147 B)
vue.global.prod.js 175 kB (+563 B) 63.2 kB (+162 B) 56.4 kB (+63 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 52.2 kB (+107 B) 20.4 kB (+21 B) 18.6 kB (+34 B)
createApp 61.3 kB (+107 B) 23.7 kB (+21 B) 21.6 kB (+21 B)
createApp + vaporInteropPlugin 112 kB (+4.26 kB) 40.3 kB (+1.37 kB) 36.3 kB (+1.2 kB)
createVaporApp 29.1 kB 11.3 kB 10.4 kB
createSSRApp 66.2 kB (+107 B) 25.6 kB (+25 B) 23.3 kB (+46 B)
createVaporSSRApp 34.4 kB 13.2 kB 12.1 kB
defineCustomElement 67.9 kB (+107 B) 25.7 kB (+20 B) 23.4 kB (+16 B)
defineVaporCustomElement 44.9 kB 16.4 kB 15 kB
overall 76.8 kB (+563 B) 29.2 kB (+165 B) 26.5 kB (+208 B)

@edison1105 edison1105 changed the title fix(runtime-vapor): apply transitions to vdom slot content fix(transition): apply vapor transitions to vdom slot content Jul 25, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/runtime-vapor/src/vdomInterop.ts (1)

1779-1801: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Guard prepareTransitionBranch(prevVNode, ...) with an isSameVNodeType check.

Unlike BaseTransition.setup(), which only re-resolves leaving hooks when !isSameVNodeType(oldInnerChild, innerChild), this call unconditionally re-prepares prevVNode's transition branch on every slot re-render whenever a transition exists — even when the patch is just an in-place update of the same node. Since enter/leave hooks are only ever invoked by the renderer on actual mount/unmount, this recomputation is wasted work on the (potentially frequent) common-update path.

♻️ Proposed guard
-              if (prevVNode && transition) {
+              if (
+                prevVNode &&
+                transition &&
+                !isSameVNodeType(prevVNode, renderedSlotContent)
+              ) {
                 // The previous VNode is already the prepared renderer subtree.
                 prepareTransitionBranch(
                   prevVNode,
                   transition.props,
                   transition.state,
                   transition.instance,
                 )
               }

(Verify isSameVNodeType is already imported/available in this file before applying.)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/runtime-vapor/src/vdomInterop.ts` around lines 1779 - 1801, Guard
the prepareTransitionBranch call in the slot re-render path with
isSameVNodeType, invoking it only when prevVNode and the current rendered vnode
represent different vnode types; preserve the existing transition and prevVNode
checks and leave the renderer patch flow unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/runtime-vapor/src/vdomInterop.ts`:
- Around line 1779-1801: Guard the prepareTransitionBranch call in the slot
re-render path with isSameVNodeType, invoking it only when prevVNode and the
current rendered vnode represent different vnode types; preserve the existing
transition and prevVNode checks and leave the renderer patch flow unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e8cd4317-3c32-4b9b-9866-43bd753caa60

📥 Commits

Reviewing files that changed from the base of the PR and between 3c9499c and 082492d.

📒 Files selected for processing (5)
  • packages/runtime-core/src/components/BaseTransition.ts
  • packages/runtime-core/src/index.ts
  • packages/runtime-vapor/__tests__/components/Transition.spec.ts
  • packages/runtime-vapor/__tests__/hydration.spec.ts
  • packages/runtime-vapor/src/vdomInterop.ts

@edison1105 edison1105 added scope: vapor related to vapor mode interop vdom / vapor interop labels Jul 25, 2026
Reuse BaseTransition's branch-switching logic so out-in and in-out modes
follow the same semantics in VDOM slot interop. Preserve pending out-in
content and correctly handle KeepAlive, Teleport, and comment-root components.
Avoid treating hooks propagated from a VDOM BaseTransition as
Vapor-owned transition state. Forward inherited hooks to slot VNodes
and only run branch switching when the hooks provide Vapor state,
props, and instance context.

Also streamline shared transition preparation and strengthen out-in
and hydration coverage.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/runtime-vapor/src/vdomInterop.ts (1)

1874-1899: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Deferred out-in patch drops slotScopeIds.

The immediate path (line 1910) and resumeOutIn (line 1675) both forward slotContent.slotScopeIds, but this placeholder patch passes null. If the prepared branch is anything other than a comment placeholder, its root renders without the slot wrapper's :slotted scope IDs for the duration of the leave. Align it with the other two call sites unless the placeholder is guaranteed to be a comment.

♻️ Suggested alignment
                 internals.p(
                   prevVNode,
                   nextVNode,
                   currentParentNode!,
                   currentAnchor,
                   parentComponent as any,
                   suspense,
                   undefined,
-                  null,
+                  slotContent.slotScopeIds,
                 )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/runtime-vapor/src/vdomInterop.ts` around lines 1874 - 1899, Update
the deferred out-in patch call to internals.p within the transition handling
branch to pass slotContent.slotScopeIds instead of null, matching the immediate
path and resumeOutIn behavior. Preserve the existing placeholder and transition
logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/runtime-vapor/src/vdomInterop.ts`:
- Around line 1874-1899: Update the deferred out-in patch call to internals.p
within the transition handling branch to pass slotContent.slotScopeIds instead
of null, matching the immediate path and resumeOutIn behavior. Preserve the
existing placeholder and transition logic.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 610e0f80-a869-4cb6-aeb4-9c1950712198

📥 Commits

Reviewing files that changed from the base of the PR and between 64810a8 and d357fa5.

📒 Files selected for processing (4)
  • packages/runtime-core/src/components/BaseTransition.ts
  • packages/runtime-vapor/__tests__/components/Transition.spec.ts
  • packages/runtime-vapor/__tests__/hydration.spec.ts
  • packages/runtime-vapor/src/vdomInterop.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/runtime-vapor/tests/hydration.spec.ts
  • packages/runtime-core/src/components/BaseTransition.ts

Share transition mode switching between VDOM slot content and Vapor fallback
blocks so out-in and in-out preserve the correct ordering, including during
rapid branch updates.
@edison1105 edison1105 changed the title fix(transition): apply vapor transitions to vdom slot content fix(runtime-vapor): support vdom slot content in Transition Jul 27, 2026
@edison1105
edison1105 marked this pull request as ready for review July 27, 2026 08:51
@edison1105

Copy link
Copy Markdown
Member Author

/ecosystem-ci run

@vue-bot

vue-bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

📝 Ran ecosystem CI: Open

suite result latest scheduled
test-utils ✅ success ✅ success
nuxt ❌ failure ❌ failure
primevue ✅ success ✅ success
vuetify ❌ failure ✅ success
vite-plugin-vue ✅ success ✅ success
vue-i18n ❌ failure ✅ success
language-tools ❌ failure ❌ failure
vueuse ✅ success ✅ success
vant ✅ success ✅ success
router ✅ success ✅ success
vue-simple-compiler ✅ success ✅ success
quasar ✅ success ✅ success
radix-vue ❌ failure ❌ failure
vue-macros ❌ failure ✅ success
vitepress ✅ success ✅ success
pinia ✅ success ✅ success

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/runtime-vapor/__tests__/_utils.ts`:
- Line 105: Update the context setup around define() and render() so the
returned context does not snapshot the initially undefined app value. Keep app
as a live reference or assign it on the retained context after render() creates
the App, ensuring context.app exposes the rendered App at runtime while
preserving the declared App type.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d9feaf50-b05c-43af-802d-9dc6ae99d3b0

📥 Commits

Reviewing files that changed from the base of the PR and between f568e72 and b50a755.

📒 Files selected for processing (5)
  • packages/runtime-core/src/components/BaseTransition.ts
  • packages/runtime-vapor/__tests__/_utils.ts
  • packages/runtime-vapor/__tests__/components/Transition.spec.ts
  • packages/runtime-vapor/__tests__/hydration.spec.ts
  • packages/runtime-vapor/src/vdomInterop.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/runtime-core/src/components/BaseTransition.ts
  • packages/runtime-vapor/tests/components/Transition.spec.ts

@edison1105
edison1105 merged commit bf59788 into minor Jul 28, 2026
14 checks passed
@edison1105
edison1105 deleted the edison/fix/vdom-slot-transition branch July 28, 2026 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

interop vdom / vapor interop scope: vapor related to vapor mode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Vapor] <Transition> does not animate VDOM content passed through <slot> (vaporInteropPlugin)

2 participants