Skip to content

refactor(runtime-vapor): replace key propagation with on-demand resolution - #15516

Merged
edison1105 merged 9 commits into
minorfrom
edison/fix/transition-key-resolution
Sep 15, 2026
Merged

edison1105 merged 9 commits into
minorfrom
edison/fix/transition-key-resolution

Conversation

@edison1105

@edison1105 edison1105 commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes
    • Corrected transition and transition-group key handling for dynamic components, nested components, fragments, slots, and v-if branches.
    • Prevented keys from incorrectly propagating to nested rendered blocks or host DOM nodes.
    • Improved key resolution for KeepAlive, Teleport, and newly added v-for rows.
    • Fixed behavior for unkeyed transition children and slot fallbacks, including out-in transitions and leave-hook reapplication.
  • Tests
    • Added coverage for component, fragment, branch, slot, and transition-group key scenarios.

@edison1105 edison1105 added the scope: vapor related to vapor mode label Sep 15, 2026
@coderabbitai

coderabbitai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Review Change StackReview 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: Advanced

Run ID: 4396af11-a05c-4b8c-8faf-ad7dbf4a1dfe

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:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 739a4284-60a5-4f1d-af53-78e0ffdb7c15

📥 Commits

Reviewing files that changed from the base of the PR and between fe309d6 and cd659f1.

⛔ Files ignored due to path filters (1)
  • packages/compiler-vapor/__tests__/transforms/__snapshots__/transformKey.spec.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (18)
  • packages/compiler-vapor/__tests__/transforms/transformKey.spec.ts
  • packages/compiler-vapor/src/transforms/transformElement.ts
  • packages/runtime-vapor/__tests__/apiCreateDynamicComponent.spec.ts
  • packages/runtime-vapor/__tests__/components/KeepAlive.spec.ts
  • packages/runtime-vapor/__tests__/components/Transition.spec.ts
  • packages/runtime-vapor/__tests__/components/TransitionGroup.spec.ts
  • packages/runtime-vapor/__tests__/helpers/setKey.spec.ts
  • packages/runtime-vapor/__tests__/if.spec.ts
  • packages/runtime-vapor/src/apiCreateFor.ts
  • packages/runtime-vapor/src/components/KeepAlive.ts
  • packages/runtime-vapor/src/components/Teleport.ts
  • packages/runtime-vapor/src/components/Transition.ts
  • packages/runtime-vapor/src/components/TransitionGroup.ts
  • packages/runtime-vapor/src/fragment.ts
  • packages/runtime-vapor/src/helpers/setKey.ts
  • packages/runtime-vapor/src/slotFragment.ts
  • packages/runtime-vapor/src/transition.ts
  • packages/runtime-vapor/src/vdomInterop.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The compiler now emits static keys only for block roots. The Vapor runtime stores keys on owning components or blocks and resolves transition keys through explicit fragment, component, list, and group context.

Changes

Vapor key ownership and transition resolution

Layer / File(s) Summary
Compiler block-root key scoping
packages/compiler-vapor/src/transforms/transformElement.ts, packages/compiler-vapor/__tests__/transforms/transformKey.spec.ts
Static keys are resolved only for block roots. Tests cover nested elements, slot roots, and v-if roots.
Runtime key ownership and transition owners
packages/runtime-vapor/src/helpers/setKey.ts, packages/runtime-vapor/src/fragment.ts, packages/runtime-vapor/src/transition.ts, packages/runtime-vapor/src/slotFragment.ts, packages/runtime-vapor/src/components/Teleport.ts
setBlockKey no longer propagates keys into rendered blocks. Transition hooks receive their owning fragment or slot state. Fragment keys are resolved through getFragmentKey.
Transition context and group resolution
packages/runtime-vapor/src/components/Transition.ts, packages/runtime-vapor/src/components/TransitionGroup.ts, packages/runtime-vapor/src/components/KeepAlive.ts, packages/runtime-vapor/src/apiCreateFor.ts, packages/runtime-vapor/src/vdomInterop.ts
Transition resolution records keys and component types through context. Transition groups compose keys for components, fragments, and v-for rows. KeepAlive and interop paths use the resolved fragment key.
Validation updates
packages/compiler-vapor/__tests__/transforms/transformKey.spec.ts, packages/runtime-vapor/__tests__/**
Tests now assert keys through getTransitionKey and verify component, fragment, list, KeepAlive, and nested transition behavior.

Priority: ⬇️ Low

Estimated code review effort: 5 (Critical) | ~90 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant VaporFragment
  participant Transition
  participant TransitionGroup
  participant ResolvedBlock
  VaporFragment->>Transition: applyTransitionHooks(owner)
  Transition->>Transition: resolveTransitionBlock(owner)
  Transition->>ResolvedBlock: store transition key and type
  TransitionGroup->>TransitionGroup: compose component, fragment, and list keys
  TransitionGroup->>ResolvedBlock: store composed transition key
Loading

Merge Risk: ⚪ Minimal · up to cd659

No merge-blocking regression is established by the available evidence.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 32 functions across 18 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly describes the main change: runtime-vapor now resolves keys on demand instead of propagating them.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch edison/fix/transition-key-resolution

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.

@pkg-pr-new

pkg-pr-new Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@vue/compiler-core

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

@vue/compiler-dom

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

@vue/compiler-sfc

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

@vue/compiler-ssr

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

@vue/compiler-vapor

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

@vue/reactivity

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

@vue/runtime-core

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

@vue/runtime-dom

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

@vue/runtime-vapor

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

@vue/server-renderer

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

@vue/shared

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

vue

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

@vue/compat

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

commit: 20a03bf

@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Size Report

Bundles

File Size Gzip Brotli
compiler-dom.global.prod.js 87.2 kB 30.6 kB 26.9 kB
runtime-dom.global.prod.js 116 kB 43.7 kB 39.1 kB
vue.global.prod.js 176 kB 63.9 kB 56.8 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 53.2 kB 20.6 kB 18.8 kB
createApp 61.9 kB 23.8 kB 21.7 kB
createApp + vaporInteropPlugin 120 kB 43.2 kB 38.9 kB
createVaporApp 30.6 kB 11.8 kB 10.8 kB
createSSRApp 67.1 kB 25.9 kB 23.5 kB
createVaporSSRApp 36.8 kB 14 kB 12.8 kB
defineCustomElement 68.5 kB 25.8 kB 23.5 kB
defineVaporCustomElement 46 kB 16.7 kB 15.4 kB
overall 77.3 kB 29.4 kB 26.6 kB

@edison1105
edison1105 marked this pull request as ready for review September 15, 2026 06:32
@edison1105 edison1105 changed the title fix(runtime-vapor): resolve transition keys from the child chain instead of propagating them refactor(runtime-vapor): replace key propagation with on-demand resolution Sep 15, 2026
@edison1105
edison1105 force-pushed the edison/fix/transition-key-resolution branch from 2986312 to 5beea56 Compare September 15, 2026 07:22
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