fix(transition): add key for transition if-branches#14374
Conversation
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThis change adds support for keyed transitions in if/else-if/else conditional chains. A compile-time index counter assigns unique identifiers to each if node within transition contexts, enabling the runtime to use keyed DynamicFragment instances for proper transition animations across branch changes. Changes
Sequence DiagramsequenceDiagram
participant Compiler as Compiler
participant IR as IR Builder
participant Runtime as Runtime
Compiler->>IR: Transform vIf in transition context
IR->>IR: Increment ifIndex counter
IR->>IR: Assign index to IfIRNode
Compiler->>Compiler: Generate createIf call with index
Note over Compiler: Compile-time indexing complete
Runtime->>Runtime: createIf(condition, block, fallback, once, index)
alt Index provided
Runtime->>Runtime: Create keyed DynamicFragment with key=`${index}:${outcome}`
else No index
Runtime->>Runtime: Create unkeyed DynamicFragment
end
Runtime->>Runtime: Setup renderEffect with keyed/unkeyed update
Note over Runtime: Runtime keying enables transitions
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Suggested labels
Poem
✨ Finishing touches
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
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Summary by CodeRabbit
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.