Skip to content

fix(runtime-vapor): avoid hydrating vapor slots during vdom collection - #14793

Merged
edison1105 merged 1 commit into
minorfrom
edison/fix/slotDryRun
May 9, 2026
Merged

edison1105 merged 1 commit into
minorfrom
edison/fix/slotDryRun

Conversation

@edison1105

@edison1105 edison1105 commented May 9, 2026 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes

    • Fixed slot vnode collection behavior in VDOM-interoperability mode
    • Improved hydration handling for slot content forwarded through intermediate components
    • Enhanced slot rendering fallback for plain and component-based slot content
  • Tests

    • Added hydration test cases validating slot vnode collection behavior
    • Expanded VDOM interoperability test suite with comprehensive slot scenario coverage

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 9, 2026 •

Copy link
Copy Markdown

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: ede08c2b-3975-4105-aad8-a89de39ad4bf

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
  • Commit unit tests in branch edison/fix/slotDryRun

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

@pkg-pr-new

pkg-pr-new Bot commented May 9, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vue/compiler-core

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

@vue/compiler-dom

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

@vue/compiler-sfc

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

@vue/compiler-ssr

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

@vue/compiler-vapor

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

@vue/reactivity

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

@vue/runtime-core

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

@vue/runtime-dom

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

@vue/runtime-vapor

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

@vue/server-renderer

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

@vue/shared

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

vue

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

@vue/compat

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

commit: 29d81c7

@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown

Size Report

Bundles

File Size Gzip Brotli
compiler-dom.global.prod.js 86.5 kB 30.3 kB 26.6 kB
runtime-dom.global.prod.js 113 kB 42.6 kB 38.1 kB
vue.global.prod.js 172 kB 62.4 kB 55.6 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 51.5 kB 20.1 kB 18.3 kB
createApp 60.5 kB 23.4 kB 21.3 kB
createApp + vaporInteropPlugin 103 kB (+909 B) 37.1 kB (+300 B) 33.4 kB (+227 B)
createVaporApp 27.4 kB 10.7 kB 9.77 kB
createSSRApp 65 kB 25.2 kB 22.9 kB
createVaporSSRApp 33.7 kB 12.8 kB 11.8 kB
defineCustomElement 67.1 kB 25.4 kB 23.1 kB
defineVaporCustomElement 40.2 kB 14.3 kB 13.1 kB
overall 75.8 kB 28.9 kB 26.2 kB

@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/__tests__/vdomInterop.spec.ts (1)

1555-1625: ⚡ Quick win

Strengthen the appContext assertion.

This proves reactive updates, but it never resolves anything through the slot owner's appContext, so the new owner.appContext branch can regress without failing here. Using a component or config that is only available through that owner context would make the test match its title.

🤖 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/__tests__/vdomInterop.spec.ts` around lines 1555 -
1625, The test must verify that invoking the captured slot uses the slot owner's
appContext by providing something only available through that owner and
asserting it resolves; update the test that assigns capturedSlot in VDomTabs so
the slot content depends on an injected/provided value or a component that is
registered only in the VaporChild owner context (e.g. use provide in VaporChild
and inject in VDomTab, or register a helper component in the VaporChild
components map and render it inside the slot), then call capturedSlot!() (as the
test already does) and assert the returned vnodes reflect the injected/provided
value or the owner-only component resolution both before and after changing data
to ensure the owner.appContext branch is exercised (refer to capturedSlot,
VDomTabs, VDomTab, VaporChild, and getLabels).
🤖 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/__tests__/vdomInterop.spec.ts`:
- Around line 1555-1625: The test must verify that invoking the captured slot
uses the slot owner's appContext by providing something only available through
that owner and asserting it resolves; update the test that assigns capturedSlot
in VDomTabs so the slot content depends on an injected/provided value or a
component that is registered only in the VaporChild owner context (e.g. use
provide in VaporChild and inject in VDomTab, or register a helper component in
the VaporChild components map and render it inside the slot), then call
capturedSlot!() (as the test already does) and assert the returned vnodes
reflect the injected/provided value or the owner-only component resolution both
before and after changing data to ensure the owner.appContext branch is
exercised (refer to capturedSlot, VDomTabs, VDomTab, VaporChild, and getLabels).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f1a10a56-1681-4cf2-8b5d-8508c8561ce7

📥 Commits

Reviewing files that changed from the base of the PR and between 778614f and 29d81c7.

📒 Files selected for processing (6)
  • packages/runtime-vapor/__tests__/hydration.spec.ts
  • packages/runtime-vapor/__tests__/vdomInterop.spec.ts
  • packages/runtime-vapor/src/component.ts
  • packages/runtime-vapor/src/componentSlots.ts
  • packages/runtime-vapor/src/vdomInterop.ts
  • packages/runtime-vapor/src/vdomInteropState.ts

@edison1105 edison1105 added the scope: vapor related to vapor mode label May 9, 2026
@edison1105
edison1105 merged commit 1de6fc4 into minor May 9, 2026
13 of 14 checks passed
@edison1105
edison1105 deleted the edison/fix/slotDryRun branch May 9, 2026 09:32
edison1105 added a commit that referenced this pull request Jul 15, 2026
…5089)

revert #14793
Vapor cannot distinguish between slots.default() calls used for VNode
inspection and calls used for actual rendering. Eager slot collection can
therefore execute user code or claim hydration nodes before rendering.
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.

1 participant