11/*!
2- * Vue.js v2.6.6
2+ * Vue.js v2.6.7
33 * (c) 2014-2019 Evan You
44 * Released under the MIT License.
55 */
@@ -1821,23 +1821,30 @@ function isBoolean () {
18211821/* */
18221822
18231823function 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+ }
18351840 }
18361841 }
18371842 }
18381843 }
1844+ globalHandleError ( err , vm , info ) ;
1845+ } finally {
1846+ popTarget ( ) ;
18391847 }
1840- globalHandleError ( err , vm , info ) ;
18411848}
18421849
18431850function invokeWithErrorHandling (
@@ -1851,7 +1858,9 @@ function invokeWithErrorHandling (
18511858 try {
18521859 res = args ? handler . apply ( context , args ) : handler . call ( context ) ;
18531860 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)" ) ; } ) ;
18551864 }
18561865 } catch ( e ) {
18571866 handleError ( e , vm , info ) ;
@@ -2534,40 +2543,44 @@ function normalizeScopedSlots (
25342543 prevSlots
25352544) {
25362545 var res ;
2546+ var isStable = slots ? ! ! slots . $stable : true ;
2547+ var key = slots && slots . $key ;
25372548 if ( ! slots ) {
25382549 res = { } ;
25392550 } else if ( slots . _normalized ) {
25402551 // fast path 1: child component re-render only, parent did not change
25412552 return slots . _normalized
25422553 } else if (
2543- slots . $stable &&
2554+ isStable &&
25442555 prevSlots &&
25452556 prevSlots !== emptyObject &&
2557+ key === prevSlots . $key &&
25462558 Object . keys ( normalSlots ) . length === 0
25472559 ) {
25482560 // fast path 2: stable scoped slots w/ no normal slots to proxy,
25492561 // only need to normalize once
25502562 return prevSlots
25512563 } else {
25522564 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 ] ) ;
25562568 }
25572569 }
25582570 }
25592571 // 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 ) ;
25632575 }
25642576 }
25652577 // avoriaz seems to mock a non-extensible $scopedSlots object
25662578 // and when that is passed down this would cause an error
25672579 if ( slots && Object . isExtensible ( slots ) ) {
25682580 ( slots ) . _normalized = res ;
25692581 }
2570- def ( res , '$stable' , slots ? ! ! slots . $stable : true ) ;
2582+ def ( res , '$stable' , isStable ) ;
2583+ def ( res , '$key' , key ) ;
25712584 return res
25722585}
25732586
@@ -2862,14 +2875,16 @@ function bindObjectListeners (data, value) {
28622875
28632876function resolveScopedSlots (
28642877 fns , // see flow/vnode
2878+ res ,
2879+ // the following are added in 2.6
28652880 hasDynamicKeys ,
2866- res
2881+ contentHashKey
28672882) {
28682883 res = res || { $stable : ! hasDynamicKeys } ;
28692884 for ( var i = 0 ; i < fns . length ; i ++ ) {
28702885 var slot = fns [ i ] ;
28712886 if ( Array . isArray ( slot ) ) {
2872- resolveScopedSlots ( slot , hasDynamicKeys , res ) ;
2887+ resolveScopedSlots ( slot , res , hasDynamicKeys ) ;
28732888 } else if ( slot ) {
28742889 // marker for reverse proxying v-slot without scope on this.$slots
28752890 if ( slot . proxy ) {
@@ -2878,6 +2893,9 @@ function resolveScopedSlots (
28782893 res [ slot . key ] = slot . fn ;
28792894 }
28802895 }
2896+ if ( contentHashKey ) {
2897+ ( res ) . $key = contentHashKey ;
2898+ }
28812899 return res
28822900}
28832901
@@ -4055,9 +4073,12 @@ function updateChildComponent (
40554073 // check if there are dynamic scopedSlots (hand-written or compiled but with
40564074 // dynamic slot names). Static scoped slots compiled from template has the
40574075 // "$stable" marker.
4076+ var newScopedSlots = parentVnode . data . scopedSlots ;
4077+ var oldScopedSlots = vm . $scopedSlots ;
40584078 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 )
40614082 ) ;
40624083
40634084 // Any static slot children from the parent may have changed during parent's
@@ -5379,7 +5400,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
53795400 value : FunctionalRenderContext
53805401} ) ;
53815402
5382- Vue . version = '2.6.6 ' ;
5403+ Vue . version = '2.6.7 ' ;
53835404
53845405/* */
53855406
@@ -7558,15 +7579,7 @@ function updateDOMProps (oldVnode, vnode) {
75587579 }
75597580 }
75607581
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' ) {
75707583 // store value as _value as well since
75717584 // non-string values will be stringified
75727585 elm . _value = cur ;
@@ -7586,8 +7599,18 @@ function updateDOMProps (oldVnode, vnode) {
75867599 while ( svg . firstChild ) {
75877600 elm . appendChild ( svg . firstChild ) ;
75887601 }
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 ) { }
75917614 }
75927615 }
75937616}
@@ -11167,22 +11190,49 @@ function genScopedSlots (
1116711190 containsSlotChild ( slot ) // is passing down slot from parent which may be dynamic
1116811191 )
1116911192 } ) ;
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.
1117211205 if ( ! needsForceUpdate ) {
1117311206 var parent = el . parent ;
1117411207 while ( parent ) {
11175- if ( parent . slotScope && parent . slotScope !== emptySlotScopeToken ) {
11208+ if (
11209+ ( parent . slotScope && parent . slotScope !== emptySlotScopeToken ) ||
11210+ parent . for
11211+ ) {
1117611212 needsForceUpdate = true ;
1117711213 break
1117811214 }
11215+ if ( parent . if ) {
11216+ needsKey = true ;
11217+ }
1117911218 parent = parent . parent ;
1118011219 }
1118111220 }
1118211221
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
1118611236}
1118711237
1118811238function containsSlotChild ( el ) {
@@ -11517,11 +11567,13 @@ function generateCodeFrame (
1151711567
1151811568function repeat$1 ( str , n ) {
1151911569 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+ }
1152511577 }
1152611578 return result
1152711579}
0 commit comments