File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,8 @@ export function renderMixin (Vue: Class<Component>) {
7373 if ( _parentVnode ) {
7474 vm . $scopedSlots = normalizeScopedSlots (
7575 _parentVnode . data . scopedSlots ,
76- vm . $slots
76+ vm . $slots ,
77+ vm . $scopedSlots
7778 )
7879 }
7980
Original file line number Diff line number Diff line change 22
33import { def } from 'core/util/lang'
44import { normalizeChildren } from 'core/vdom/helpers/normalize-children'
5+ import { emptyObject } from 'shared/util'
56
67export function normalizeScopedSlots (
78 slots : { [ key : string ] : Function } | void ,
8- normalSlots : { [ key : string ] : Array < VNode > }
9+ normalSlots : { [ key : string ] : Array < VNode > } ,
10+ prevSlots ?: { [ key : string ] : Function } | void
911) : any {
1012 let res
1113 if ( ! slots ) {
1214 res = { }
1315 } else if ( slots . _normalized ) {
14- return slots
16+ // fast path 1: child component re-render only, parent did not change
17+ return slots . _normalized
18+ } else if ( slots . $stable && prevSlots && prevSlots !== emptyObject ) {
19+ // fast path 2: stable scoped slots, only need to normalize once
20+ return prevSlots
1521 } else {
1622 res = { }
1723 for ( const key in slots ) {
@@ -26,7 +32,9 @@ export function normalizeScopedSlots (
2632 res [ key ] = proxyNormalSlot ( normalSlots , key )
2733 }
2834 }
29- def ( res , '_normalized' , true )
35+ if ( slots ) {
36+ ( slots : any ) . _normalized = res
37+ }
3038 def ( res , '$stable' , slots ? ! ! slots . $stable : true )
3139 return res
3240}
You can’t perform that action at this time.
0 commit comments