1
1
/*!
2
- * Vue.js v2.6.6
2
+ * Vue.js v2.6.7
3
3
* (c) 2014-2019 Evan You
4
4
* Released under the MIT License.
5
5
*/
@@ -1821,23 +1821,30 @@ function isBoolean () {
1821
1821
/* */
1822
1822
1823
1823
function handleError ( err , vm , info ) {
1824
- if ( vm ) {
1825
- var cur = vm ;
1826
- while ( ( cur = cur . $parent ) ) {
1827
- var hooks = cur . $options . errorCaptured ;
1828
- if ( hooks ) {
1829
- for ( var i = 0 ; i < hooks . length ; i ++ ) {
1830
- try {
1831
- var capture = hooks [ i ] . call ( cur , err , vm , info ) === false ;
1832
- if ( capture ) { return }
1833
- } catch ( e ) {
1834
- globalHandleError ( e , cur , 'errorCaptured hook' ) ;
1824
+ // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
1825
+ // See: https://github.com/vuejs/vuex/issues/1505
1826
+ pushTarget ( ) ;
1827
+ try {
1828
+ if ( vm ) {
1829
+ var cur = vm ;
1830
+ while ( ( cur = cur . $parent ) ) {
1831
+ var hooks = cur . $options . errorCaptured ;
1832
+ if ( hooks ) {
1833
+ for ( var i = 0 ; i < hooks . length ; i ++ ) {
1834
+ try {
1835
+ var capture = hooks [ i ] . call ( cur , err , vm , info ) === false ;
1836
+ if ( capture ) { return }
1837
+ } catch ( e ) {
1838
+ globalHandleError ( e , cur , 'errorCaptured hook' ) ;
1839
+ }
1835
1840
}
1836
1841
}
1837
1842
}
1838
1843
}
1844
+ globalHandleError ( err , vm , info ) ;
1845
+ } finally {
1846
+ popTarget ( ) ;
1839
1847
}
1840
- globalHandleError ( err , vm , info ) ;
1841
1848
}
1842
1849
1843
1850
function invokeWithErrorHandling (
@@ -1851,7 +1858,9 @@ function invokeWithErrorHandling (
1851
1858
try {
1852
1859
res = args ? handler . apply ( context , args ) : handler . call ( context ) ;
1853
1860
if ( res && ! res . _isVue && isPromise ( res ) ) {
1854
- res . catch ( function ( e ) { return handleError ( e , vm , info + " (Promise/async)" ) ; } ) ;
1861
+ // issue #9511
1862
+ // reassign to res to avoid catch triggering multiple times when nested calls
1863
+ res = res . catch ( function ( e ) { return handleError ( e , vm , info + " (Promise/async)" ) ; } ) ;
1855
1864
}
1856
1865
} catch ( e ) {
1857
1866
handleError ( e , vm , info ) ;
@@ -2534,40 +2543,44 @@ function normalizeScopedSlots (
2534
2543
prevSlots
2535
2544
) {
2536
2545
var res ;
2546
+ var isStable = slots ? ! ! slots . $stable : true ;
2547
+ var key = slots && slots . $key ;
2537
2548
if ( ! slots ) {
2538
2549
res = { } ;
2539
2550
} else if ( slots . _normalized ) {
2540
2551
// fast path 1: child component re-render only, parent did not change
2541
2552
return slots . _normalized
2542
2553
} else if (
2543
- slots . $stable &&
2554
+ isStable &&
2544
2555
prevSlots &&
2545
2556
prevSlots !== emptyObject &&
2557
+ key === prevSlots . $key &&
2546
2558
Object . keys ( normalSlots ) . length === 0
2547
2559
) {
2548
2560
// fast path 2: stable scoped slots w/ no normal slots to proxy,
2549
2561
// only need to normalize once
2550
2562
return prevSlots
2551
2563
} else {
2552
2564
res = { } ;
2553
- for ( var key in slots ) {
2554
- if ( slots [ key ] && key [ 0 ] !== '$' ) {
2555
- res [ key ] = normalizeScopedSlot ( normalSlots , key , slots [ key ] ) ;
2565
+ for ( var key$1 in slots ) {
2566
+ if ( slots [ key$1 ] && key$1 [ 0 ] !== '$' ) {
2567
+ res [ key$1 ] = normalizeScopedSlot ( normalSlots , key$1 , slots [ key$1 ] ) ;
2556
2568
}
2557
2569
}
2558
2570
}
2559
2571
// expose normal slots on scopedSlots
2560
- for ( var key$1 in normalSlots ) {
2561
- if ( ! ( key$1 in res ) ) {
2562
- res [ key$1 ] = proxyNormalSlot ( normalSlots , key$1 ) ;
2572
+ for ( var key$2 in normalSlots ) {
2573
+ if ( ! ( key$2 in res ) ) {
2574
+ res [ key$2 ] = proxyNormalSlot ( normalSlots , key$2 ) ;
2563
2575
}
2564
2576
}
2565
2577
// avoriaz seems to mock a non-extensible $scopedSlots object
2566
2578
// and when that is passed down this would cause an error
2567
2579
if ( slots && Object . isExtensible ( slots ) ) {
2568
2580
( slots ) . _normalized = res ;
2569
2581
}
2570
- def ( res , '$stable' , slots ? ! ! slots . $stable : true ) ;
2582
+ def ( res , '$stable' , isStable ) ;
2583
+ def ( res , '$key' , key ) ;
2571
2584
return res
2572
2585
}
2573
2586
@@ -2862,14 +2875,16 @@ function bindObjectListeners (data, value) {
2862
2875
2863
2876
function resolveScopedSlots (
2864
2877
fns , // see flow/vnode
2878
+ res ,
2879
+ // the following are added in 2.6
2865
2880
hasDynamicKeys ,
2866
- res
2881
+ contentHashKey
2867
2882
) {
2868
2883
res = res || { $stable : ! hasDynamicKeys } ;
2869
2884
for ( var i = 0 ; i < fns . length ; i ++ ) {
2870
2885
var slot = fns [ i ] ;
2871
2886
if ( Array . isArray ( slot ) ) {
2872
- resolveScopedSlots ( slot , hasDynamicKeys , res ) ;
2887
+ resolveScopedSlots ( slot , res , hasDynamicKeys ) ;
2873
2888
} else if ( slot ) {
2874
2889
// marker for reverse proxying v-slot without scope on this.$slots
2875
2890
if ( slot . proxy ) {
@@ -2878,6 +2893,9 @@ function resolveScopedSlots (
2878
2893
res [ slot . key ] = slot . fn ;
2879
2894
}
2880
2895
}
2896
+ if ( contentHashKey ) {
2897
+ ( res ) . $key = contentHashKey ;
2898
+ }
2881
2899
return res
2882
2900
}
2883
2901
@@ -4055,9 +4073,12 @@ function updateChildComponent (
4055
4073
// check if there are dynamic scopedSlots (hand-written or compiled but with
4056
4074
// dynamic slot names). Static scoped slots compiled from template has the
4057
4075
// "$stable" marker.
4076
+ var newScopedSlots = parentVnode . data . scopedSlots ;
4077
+ var oldScopedSlots = vm . $scopedSlots ;
4058
4078
var hasDynamicScopedSlot = ! ! (
4059
- ( parentVnode . data . scopedSlots && ! parentVnode . data . scopedSlots . $stable ) ||
4060
- ( vm . $scopedSlots !== emptyObject && ! vm . $scopedSlots . $stable )
4079
+ ( newScopedSlots && ! newScopedSlots . $stable ) ||
4080
+ ( oldScopedSlots !== emptyObject && ! oldScopedSlots . $stable ) ||
4081
+ ( newScopedSlots && vm . $scopedSlots . $key !== newScopedSlots . $key )
4061
4082
) ;
4062
4083
4063
4084
// Any static slot children from the parent may have changed during parent's
@@ -5379,7 +5400,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
5379
5400
value : FunctionalRenderContext
5380
5401
} ) ;
5381
5402
5382
- Vue . version = '2.6.6 ' ;
5403
+ Vue . version = '2.6.7 ' ;
5383
5404
5384
5405
/* */
5385
5406
@@ -7558,15 +7579,7 @@ function updateDOMProps (oldVnode, vnode) {
7558
7579
}
7559
7580
}
7560
7581
7561
- // skip the update if old and new VDOM state is the same.
7562
- // the only exception is `value` where the DOM value may be temporarily
7563
- // out of sync with VDOM state due to focus, composition and modifiers.
7564
- // This also covers #4521 by skipping the unnecesarry `checked` update.
7565
- if ( key !== 'value' && cur === oldProps [ key ] ) {
7566
- continue
7567
- }
7568
-
7569
- if ( key === 'value' ) {
7582
+ if ( key === 'value' && elm . tagName !== 'PROGRESS' ) {
7570
7583
// store value as _value as well since
7571
7584
// non-string values will be stringified
7572
7585
elm . _value = cur ;
@@ -7586,8 +7599,18 @@ function updateDOMProps (oldVnode, vnode) {
7586
7599
while ( svg . firstChild ) {
7587
7600
elm . appendChild ( svg . firstChild ) ;
7588
7601
}
7589
- } else {
7590
- elm [ key ] = cur ;
7602
+ } else if (
7603
+ // skip the update if old and new VDOM state is the same.
7604
+ // `value` is handled separately because the DOM value may be temporarily
7605
+ // out of sync with VDOM state due to focus, composition and modifiers.
7606
+ // This #4521 by skipping the unnecesarry `checked` update.
7607
+ cur !== oldProps [ key ]
7608
+ ) {
7609
+ // some property updates can throw
7610
+ // e.g. `value` on <progress> w/ non-finite value
7611
+ try {
7612
+ elm [ key ] = cur ;
7613
+ } catch ( e ) { }
7591
7614
}
7592
7615
}
7593
7616
}
@@ -11167,22 +11190,49 @@ function genScopedSlots (
11167
11190
containsSlotChild ( slot ) // is passing down slot from parent which may be dynamic
11168
11191
)
11169
11192
} ) ;
11170
- // OR when it is inside another scoped slot (the reactivity is disconnected)
11171
- // #9438
11193
+
11194
+ // #9534: if a component with scoped slots is inside a conditional branch,
11195
+ // it's possible for the same component to be reused but with different
11196
+ // compiled slot content. To avoid that, we generate a unique key based on
11197
+ // the generated code of all the slot contents.
11198
+ var needsKey = ! ! el . if ;
11199
+
11200
+ // OR when it is inside another scoped slot or v-for (the reactivity may be
11201
+ // disconnected due to the intermediate scope variable)
11202
+ // #9438, #9506
11203
+ // TODO: this can be further optimized by properly analyzing in-scope bindings
11204
+ // and skip force updating ones that do not actually use scope variables.
11172
11205
if ( ! needsForceUpdate ) {
11173
11206
var parent = el . parent ;
11174
11207
while ( parent ) {
11175
- if ( parent . slotScope && parent . slotScope !== emptySlotScopeToken ) {
11208
+ if (
11209
+ ( parent . slotScope && parent . slotScope !== emptySlotScopeToken ) ||
11210
+ parent . for
11211
+ ) {
11176
11212
needsForceUpdate = true ;
11177
11213
break
11178
11214
}
11215
+ if ( parent . if ) {
11216
+ needsKey = true ;
11217
+ }
11179
11218
parent = parent . parent ;
11180
11219
}
11181
11220
}
11182
11221
11183
- return ( "scopedSlots:_u([" + ( Object . keys ( slots ) . map ( function ( key ) {
11184
- return genScopedSlot ( slots [ key ] , state )
11185
- } ) . join ( ',' ) ) + "]" + ( needsForceUpdate ? ",true" : "" ) + ")" )
11222
+ var generatedSlots = Object . keys ( slots )
11223
+ . map ( function ( key ) { return genScopedSlot ( slots [ key ] , state ) ; } )
11224
+ . join ( ',' ) ;
11225
+
11226
+ return ( "scopedSlots:_u([" + generatedSlots + "]" + ( needsForceUpdate ? ",null,true" : "" ) + ( ! needsForceUpdate && needsKey ? ( ",null,false," + ( hash ( generatedSlots ) ) ) : "" ) + ")" )
11227
+ }
11228
+
11229
+ function hash ( str ) {
11230
+ var hash = 5381 ;
11231
+ var i = str . length ;
11232
+ while ( i ) {
11233
+ hash = ( hash * 33 ) ^ str . charCodeAt ( -- i ) ;
11234
+ }
11235
+ return hash >>> 0
11186
11236
}
11187
11237
11188
11238
function containsSlotChild ( el ) {
@@ -11517,11 +11567,13 @@ function generateCodeFrame (
11517
11567
11518
11568
function repeat$1 ( str , n ) {
11519
11569
var result = '' ;
11520
- while ( true ) { // eslint-disable-line
11521
- if ( n & 1 ) { result += str ; }
11522
- n >>>= 1 ;
11523
- if ( n <= 0 ) { break }
11524
- str += str ;
11570
+ if ( n > 0 ) {
11571
+ while ( true ) { // eslint-disable-line
11572
+ if ( n & 1 ) { result += str ; }
11573
+ n >>>= 1 ;
11574
+ if ( n <= 0 ) { break }
11575
+ str += str ;
11576
+ }
11525
11577
}
11526
11578
return result
11527
11579
}
0 commit comments