Repository navigation
fix(runtime-vapor): support vdom slot content in Transition - #15159
Conversation
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.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughChangesThe PR extracts reusable transition child and branch preparation helpers from VDOM slot transition interop
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
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/compiler-vapor
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/runtime-vapor
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
Size ReportBundles
Usages
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/runtime-vapor/src/vdomInterop.ts (1)
1779-1801: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winGuard
prepareTransitionBranch(prevVNode, ...)with anisSameVNodeTypecheck.Unlike
BaseTransition.setup(), which only re-resolves leaving hooks when!isSameVNodeType(oldInnerChild, innerChild), this call unconditionally re-preparesprevVNode'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
isSameVNodeTypeis 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
📒 Files selected for processing (5)
packages/runtime-core/src/components/BaseTransition.tspackages/runtime-core/src/index.tspackages/runtime-vapor/__tests__/components/Transition.spec.tspackages/runtime-vapor/__tests__/hydration.spec.tspackages/runtime-vapor/src/vdomInterop.ts
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.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/runtime-vapor/src/vdomInterop.ts (1)
1874-1899: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winDeferred out-in patch drops
slotScopeIds.The immediate path (line 1910) and
resumeOutIn(line 1675) both forwardslotContent.slotScopeIds, but this placeholder patch passesnull. If the prepared branch is anything other than a comment placeholder, its root renders without the slot wrapper's:slottedscope 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
📒 Files selected for processing (4)
packages/runtime-core/src/components/BaseTransition.tspackages/runtime-vapor/__tests__/components/Transition.spec.tspackages/runtime-vapor/__tests__/hydration.spec.tspackages/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.
|
/ecosystem-ci run |
|
📝 Ran ecosystem CI: Open
|
There was a problem hiding this comment.
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
📒 Files selected for processing (5)
packages/runtime-core/src/components/BaseTransition.tspackages/runtime-vapor/__tests__/_utils.tspackages/runtime-vapor/__tests__/components/Transition.spec.tspackages/runtime-vapor/__tests__/hydration.spec.tspackages/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
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
out-inandin-outmodes.