vue 2.6.6 → 2.6.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +24 -19
  2. package/dist/README.md +1 -1
  3. package/dist/vue.common.dev.js +169 -80
  4. package/dist/vue.common.prod.js +2 -2
  5. package/dist/vue.esm.browser.js +167 -76
  6. package/dist/vue.esm.browser.min.js +2 -2
  7. package/dist/vue.esm.js +169 -80
  8. package/dist/vue.js +169 -80
  9. package/dist/vue.min.js +2 -2
  10. package/dist/vue.runtime.common.dev.js +121 -62
  11. package/dist/vue.runtime.common.prod.js +2 -2
  12. package/dist/vue.runtime.esm.js +121 -62
  13. package/dist/vue.runtime.js +121 -62
  14. package/dist/vue.runtime.min.js +2 -2
  15. package/package.json +2 -2
  16. package/src/compiler/codeframe.js +7 -5
  17. package/src/compiler/codegen/events.js +1 -1
  18. package/src/compiler/codegen/index.js +38 -9
  19. package/src/compiler/parser/html-parser.js +3 -3
  20. package/src/compiler/parser/index.js +4 -3
  21. package/src/core/instance/lifecycle.js +5 -2
  22. package/src/core/instance/render-helpers/bind-object-props.js +5 -3
  23. package/src/core/instance/render-helpers/resolve-scoped-slots.js +7 -2
  24. package/src/core/observer/scheduler.js +17 -6
  25. package/src/core/util/error.js +24 -13
  26. package/src/core/util/lang.js +2 -2
  27. package/src/core/util/options.js +2 -2
  28. package/src/core/vdom/helpers/normalize-scoped-slots.js +14 -5
  29. package/src/core/vdom/helpers/resolve-async-component.js +25 -8
  30. package/src/platforms/web/runtime/modules/dom-props.js +15 -12
  31. package/src/platforms/web/runtime/modules/events.js +4 -2
  32. package/src/platforms/web/runtime/modules/transition.js +1 -1
  33. package/src/server/template-renderer/create-async-file-mapper.js +2 -2
  34. package/src/server/write.js +1 -1
  35. package/types/options.d.ts +3 -3
  36. package/types/vnode.d.ts +6 -2
  37. package/types/vue.d.ts +3 -3
package/dist/vue.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Vue.js v2.6.6
2
+ * Vue.js v2.6.10
3
3
  * (c) 2014-2019 Evan You
4
4
  * Released under the MIT License.
5
5
  */
@@ -481,7 +481,7 @@
481
481
  * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
482
482
  * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
483
483
  */
484
- var unicodeLetters = 'a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD';
484
+ var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
485
485
 
486
486
  /**
487
487
  * Check if a string starts with $ or _
@@ -506,7 +506,7 @@
506
506
  /**
507
507
  * Parse simple path.
508
508
  */
509
- var bailRE = new RegExp(("[^" + unicodeLetters + ".$_\\d]"));
509
+ var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
510
510
  function parsePath (path) {
511
511
  if (bailRE.test(path)) {
512
512
  return
@@ -1410,7 +1410,7 @@
1410
1410
  }
1411
1411
 
1412
1412
  function validateComponentName (name) {
1413
- if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + unicodeLetters + "]*$")).test(name)) {
1413
+ if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
1414
1414
  warn(
1415
1415
  'Invalid component name: "' + name + '". Component names ' +
1416
1416
  'should conform to valid custom element name in html5 specification.'
@@ -1825,23 +1825,30 @@
1825
1825
  /* */
1826
1826
 
1827
1827
  function handleError (err, vm, info) {
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');
1828
+ // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
1829
+ // See: https://github.com/vuejs/vuex/issues/1505
1830
+ pushTarget();
1831
+ try {
1832
+ if (vm) {
1833
+ var cur = vm;
1834
+ while ((cur = cur.$parent)) {
1835
+ var hooks = cur.$options.errorCaptured;
1836
+ if (hooks) {
1837
+ for (var i = 0; i < hooks.length; i++) {
1838
+ try {
1839
+ var capture = hooks[i].call(cur, err, vm, info) === false;
1840
+ if (capture) { return }
1841
+ } catch (e) {
1842
+ globalHandleError(e, cur, 'errorCaptured hook');
1843
+ }
1839
1844
  }
1840
1845
  }
1841
1846
  }
1842
1847
  }
1848
+ globalHandleError(err, vm, info);
1849
+ } finally {
1850
+ popTarget();
1843
1851
  }
1844
- globalHandleError(err, vm, info);
1845
1852
  }
1846
1853
 
1847
1854
  function invokeWithErrorHandling (
@@ -1854,8 +1861,11 @@
1854
1861
  var res;
1855
1862
  try {
1856
1863
  res = args ? handler.apply(context, args) : handler.call(context);
1857
- if (res && !res._isVue && isPromise(res)) {
1864
+ if (res && !res._isVue && isPromise(res) && !res._handled) {
1858
1865
  res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
1866
+ // issue #9511
1867
+ // avoid catch triggering multiple times when nested calls
1868
+ res._handled = true;
1859
1869
  }
1860
1870
  } catch (e) {
1861
1871
  handleError(e, vm, info);
@@ -2538,32 +2548,37 @@
2538
2548
  prevSlots
2539
2549
  ) {
2540
2550
  var res;
2551
+ var hasNormalSlots = Object.keys(normalSlots).length > 0;
2552
+ var isStable = slots ? !!slots.$stable : !hasNormalSlots;
2553
+ var key = slots && slots.$key;
2541
2554
  if (!slots) {
2542
2555
  res = {};
2543
2556
  } else if (slots._normalized) {
2544
2557
  // fast path 1: child component re-render only, parent did not change
2545
2558
  return slots._normalized
2546
2559
  } else if (
2547
- slots.$stable &&
2560
+ isStable &&
2548
2561
  prevSlots &&
2549
2562
  prevSlots !== emptyObject &&
2550
- Object.keys(normalSlots).length === 0
2563
+ key === prevSlots.$key &&
2564
+ !hasNormalSlots &&
2565
+ !prevSlots.$hasNormal
2551
2566
  ) {
2552
2567
  // fast path 2: stable scoped slots w/ no normal slots to proxy,
2553
2568
  // only need to normalize once
2554
2569
  return prevSlots
2555
2570
  } else {
2556
2571
  res = {};
2557
- for (var key in slots) {
2558
- if (slots[key] && key[0] !== '$') {
2559
- res[key] = normalizeScopedSlot(normalSlots, key, slots[key]);
2572
+ for (var key$1 in slots) {
2573
+ if (slots[key$1] && key$1[0] !== '$') {
2574
+ res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
2560
2575
  }
2561
2576
  }
2562
2577
  }
2563
2578
  // expose normal slots on scopedSlots
2564
- for (var key$1 in normalSlots) {
2565
- if (!(key$1 in res)) {
2566
- res[key$1] = proxyNormalSlot(normalSlots, key$1);
2579
+ for (var key$2 in normalSlots) {
2580
+ if (!(key$2 in res)) {
2581
+ res[key$2] = proxyNormalSlot(normalSlots, key$2);
2567
2582
  }
2568
2583
  }
2569
2584
  // avoriaz seems to mock a non-extensible $scopedSlots object
@@ -2571,7 +2586,9 @@
2571
2586
  if (slots && Object.isExtensible(slots)) {
2572
2587
  (slots)._normalized = res;
2573
2588
  }
2574
- def(res, '$stable', slots ? !!slots.$stable : true);
2589
+ def(res, '$stable', isStable);
2590
+ def(res, '$key', key);
2591
+ def(res, '$hasNormal', hasNormalSlots);
2575
2592
  return res
2576
2593
  }
2577
2594
 
@@ -2581,8 +2598,10 @@
2581
2598
  res = res && typeof res === 'object' && !Array.isArray(res)
2582
2599
  ? [res] // single vnode
2583
2600
  : normalizeChildren(res);
2584
- return res && res.length === 0
2585
- ? undefined
2601
+ return res && (
2602
+ res.length === 0 ||
2603
+ (res.length === 1 && res[0].isComment) // #9658
2604
+ ) ? undefined
2586
2605
  : res
2587
2606
  };
2588
2607
  // this is a slot using the new v-slot syntax without scope. although it is
@@ -2762,12 +2781,13 @@
2762
2781
  : data.attrs || (data.attrs = {});
2763
2782
  }
2764
2783
  var camelizedKey = camelize(key);
2765
- if (!(key in hash) && !(camelizedKey in hash)) {
2784
+ var hyphenatedKey = hyphenate(key);
2785
+ if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
2766
2786
  hash[key] = value[key];
2767
2787
 
2768
2788
  if (isSync) {
2769
2789
  var on = data.on || (data.on = {});
2770
- on[("update:" + camelizedKey)] = function ($event) {
2790
+ on[("update:" + key)] = function ($event) {
2771
2791
  value[key] = $event;
2772
2792
  };
2773
2793
  }
@@ -2866,14 +2886,16 @@
2866
2886
 
2867
2887
  function resolveScopedSlots (
2868
2888
  fns, // see flow/vnode
2889
+ res,
2890
+ // the following are added in 2.6
2869
2891
  hasDynamicKeys,
2870
- res
2892
+ contentHashKey
2871
2893
  ) {
2872
2894
  res = res || { $stable: !hasDynamicKeys };
2873
2895
  for (var i = 0; i < fns.length; i++) {
2874
2896
  var slot = fns[i];
2875
2897
  if (Array.isArray(slot)) {
2876
- resolveScopedSlots(slot, hasDynamicKeys, res);
2898
+ resolveScopedSlots(slot, res, hasDynamicKeys);
2877
2899
  } else if (slot) {
2878
2900
  // marker for reverse proxying v-slot without scope on this.$slots
2879
2901
  if (slot.proxy) {
@@ -2882,6 +2904,9 @@
2882
2904
  res[slot.key] = slot.fn;
2883
2905
  }
2884
2906
  }
2907
+ if (contentHashKey) {
2908
+ (res).$key = contentHashKey;
2909
+ }
2885
2910
  return res
2886
2911
  }
2887
2912
 
@@ -3596,17 +3621,23 @@
3596
3621
  return factory.resolved
3597
3622
  }
3598
3623
 
3624
+ var owner = currentRenderingInstance;
3625
+ if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
3626
+ // already pending
3627
+ factory.owners.push(owner);
3628
+ }
3629
+
3599
3630
  if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
3600
3631
  return factory.loadingComp
3601
3632
  }
3602
3633
 
3603
- var owner = currentRenderingInstance;
3604
- if (isDef(factory.owners)) {
3605
- // already pending
3606
- factory.owners.push(owner);
3607
- } else {
3634
+ if (owner && !isDef(factory.owners)) {
3608
3635
  var owners = factory.owners = [owner];
3609
3636
  var sync = true;
3637
+ var timerLoading = null;
3638
+ var timerTimeout = null
3639
+
3640
+ ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
3610
3641
 
3611
3642
  var forceRender = function (renderCompleted) {
3612
3643
  for (var i = 0, l = owners.length; i < l; i++) {
@@ -3615,6 +3646,14 @@
3615
3646
 
3616
3647
  if (renderCompleted) {
3617
3648
  owners.length = 0;
3649
+ if (timerLoading !== null) {
3650
+ clearTimeout(timerLoading);
3651
+ timerLoading = null;
3652
+ }
3653
+ if (timerTimeout !== null) {
3654
+ clearTimeout(timerTimeout);
3655
+ timerTimeout = null;
3656
+ }
3618
3657
  }
3619
3658
  };
3620
3659
 
@@ -3661,7 +3700,8 @@
3661
3700
  if (res.delay === 0) {
3662
3701
  factory.loading = true;
3663
3702
  } else {
3664
- setTimeout(function () {
3703
+ timerLoading = setTimeout(function () {
3704
+ timerLoading = null;
3665
3705
  if (isUndef(factory.resolved) && isUndef(factory.error)) {
3666
3706
  factory.loading = true;
3667
3707
  forceRender(false);
@@ -3671,7 +3711,8 @@
3671
3711
  }
3672
3712
 
3673
3713
  if (isDef(res.timeout)) {
3674
- setTimeout(function () {
3714
+ timerTimeout = setTimeout(function () {
3715
+ timerTimeout = null;
3675
3716
  if (isUndef(factory.resolved)) {
3676
3717
  reject(
3677
3718
  "timeout (" + (res.timeout) + "ms)"
@@ -4059,9 +4100,12 @@
4059
4100
  // check if there are dynamic scopedSlots (hand-written or compiled but with
4060
4101
  // dynamic slot names). Static scoped slots compiled from template has the
4061
4102
  // "$stable" marker.
4103
+ var newScopedSlots = parentVnode.data.scopedSlots;
4104
+ var oldScopedSlots = vm.$scopedSlots;
4062
4105
  var hasDynamicScopedSlot = !!(
4063
- (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) ||
4064
- (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable)
4106
+ (newScopedSlots && !newScopedSlots.$stable) ||
4107
+ (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
4108
+ (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
4065
4109
  );
4066
4110
 
4067
4111
  // Any static slot children from the parent may have changed during parent's
@@ -4214,11 +4258,21 @@
4214
4258
  // timestamp can either be hi-res (relative to page load) or low-res
4215
4259
  // (relative to UNIX epoch), so in order to compare time we have to use the
4216
4260
  // same timestamp type when saving the flush timestamp.
4217
- if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
4218
- // if the low-res timestamp which is bigger than the event timestamp
4219
- // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
4220
- // and we need to use the hi-res version for event listeners as well.
4221
- getNow = function () { return performance.now(); };
4261
+ // All IE versions use low-res event timestamps, and have problematic clock
4262
+ // implementations (#9632)
4263
+ if (inBrowser && !isIE) {
4264
+ var performance = window.performance;
4265
+ if (
4266
+ performance &&
4267
+ typeof performance.now === 'function' &&
4268
+ getNow() > document.createEvent('Event').timeStamp
4269
+ ) {
4270
+ // if the event timestamp, although evaluated AFTER the Date.now(), is
4271
+ // smaller than it, it means the event is using a hi-res timestamp,
4272
+ // and we need to use the hi-res version for event listener timestamps as
4273
+ // well.
4274
+ getNow = function () { return performance.now(); };
4275
+ }
4222
4276
  }
4223
4277
 
4224
4278
  /**
@@ -5383,7 +5437,7 @@
5383
5437
  value: FunctionalRenderContext
5384
5438
  });
5385
5439
 
5386
- Vue.version = '2.6.6';
5440
+ Vue.version = '2.6.10';
5387
5441
 
5388
5442
  /* */
5389
5443
 
@@ -7475,8 +7529,10 @@
7475
7529
  e.target === e.currentTarget ||
7476
7530
  // event is fired after handler attachment
7477
7531
  e.timeStamp >= attachedTimestamp ||
7478
- // #9462 bail for iOS 9 bug: event.timeStamp is 0 after history.pushState
7479
- e.timeStamp === 0 ||
7532
+ // bail for environments that have buggy event.timeStamp implementations
7533
+ // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
7534
+ // #9681 QtWebEngine event.timeStamp is negative value
7535
+ e.timeStamp <= 0 ||
7480
7536
  // #9448 bail if event is fired in another document in a multi-page
7481
7537
  // electron/nw.js app, since event.timeStamp will be using a different
7482
7538
  // starting reference
@@ -7543,10 +7599,11 @@
7543
7599
  }
7544
7600
 
7545
7601
  for (key in oldProps) {
7546
- if (isUndef(props[key])) {
7602
+ if (!(key in props)) {
7547
7603
  elm[key] = '';
7548
7604
  }
7549
7605
  }
7606
+
7550
7607
  for (key in props) {
7551
7608
  cur = props[key];
7552
7609
  // ignore children if the node has textContent or innerHTML,
@@ -7562,15 +7619,7 @@
7562
7619
  }
7563
7620
  }
7564
7621
 
7565
- // skip the update if old and new VDOM state is the same.
7566
- // the only exception is `value` where the DOM value may be temporarily
7567
- // out of sync with VDOM state due to focus, composition and modifiers.
7568
- // This also covers #4521 by skipping the unnecesarry `checked` update.
7569
- if (key !== 'value' && cur === oldProps[key]) {
7570
- continue
7571
- }
7572
-
7573
- if (key === 'value') {
7622
+ if (key === 'value' && elm.tagName !== 'PROGRESS') {
7574
7623
  // store value as _value as well since
7575
7624
  // non-string values will be stringified
7576
7625
  elm._value = cur;
@@ -7590,8 +7639,18 @@
7590
7639
  while (svg.firstChild) {
7591
7640
  elm.appendChild(svg.firstChild);
7592
7641
  }
7593
- } else {
7594
- elm[key] = cur;
7642
+ } else if (
7643
+ // skip the update if old and new VDOM state is the same.
7644
+ // `value` is handled separately because the DOM value may be temporarily
7645
+ // out of sync with VDOM state due to focus, composition and modifiers.
7646
+ // This #4521 by skipping the unnecesarry `checked` update.
7647
+ cur !== oldProps[key]
7648
+ ) {
7649
+ // some property updates can throw
7650
+ // e.g. `value` on <progress> w/ non-finite value
7651
+ try {
7652
+ elm[key] = cur;
7653
+ } catch (e) {}
7595
7654
  }
7596
7655
  }
7597
7656
  }
@@ -8092,8 +8151,8 @@
8092
8151
  var context = activeInstance;
8093
8152
  var transitionNode = activeInstance.$vnode;
8094
8153
  while (transitionNode && transitionNode.parent) {
8095
- transitionNode = transitionNode.parent;
8096
8154
  context = transitionNode.context;
8155
+ transitionNode = transitionNode.parent;
8097
8156
  }
8098
8157
 
8099
8158
  var isAppear = !context._isMounted || !vnode.isRootInsert;
@@ -9183,7 +9242,7 @@
9183
9242
  // Regular Expressions for parsing tags and attributes
9184
9243
  var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
9185
9244
  var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
9186
- var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + unicodeLetters + "]*";
9245
+ var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
9187
9246
  var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
9188
9247
  var startTagOpen = new RegExp(("^<" + qnameCapture));
9189
9248
  var startTagClose = /^\s*(\/?)>/;
@@ -9445,7 +9504,7 @@
9445
9504
  ) {
9446
9505
  options.warn(
9447
9506
  ("tag <" + (stack[i].tag) + "> has no matching end tag."),
9448
- { start: stack[i].start }
9507
+ { start: stack[i].start, end: stack[i].end }
9449
9508
  );
9450
9509
  }
9451
9510
  if (options.end) {
@@ -9482,7 +9541,7 @@
9482
9541
 
9483
9542
  var argRE = /:(.*)$/;
9484
9543
  var bindRE = /^:|^\.|^v-bind:/;
9485
- var modifierRE = /\.[^.]+/g;
9544
+ var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
9486
9545
 
9487
9546
  var slotRE = /^v-slot(:|$)|^#/;
9488
9547
 
@@ -9659,7 +9718,7 @@
9659
9718
  shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
9660
9719
  shouldKeepComment: options.comments,
9661
9720
  outputSourceRange: options.outputSourceRange,
9662
- start: function start (tag, attrs, unary, start$1) {
9721
+ start: function start (tag, attrs, unary, start$1, end) {
9663
9722
  // check namespace.
9664
9723
  // inherit parent ns if there is one
9665
9724
  var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
@@ -9678,6 +9737,7 @@
9678
9737
  {
9679
9738
  if (options.outputSourceRange) {
9680
9739
  element.start = start$1;
9740
+ element.end = end;
9681
9741
  element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
9682
9742
  cumulated[attr.name] = attr;
9683
9743
  return cumulated
@@ -9799,7 +9859,7 @@
9799
9859
  text = preserveWhitespace ? ' ' : '';
9800
9860
  }
9801
9861
  if (text) {
9802
- if (whitespaceOption === 'condense') {
9862
+ if (!inPre && whitespaceOption === 'condense') {
9803
9863
  // condense consecutive whitespaces into single space
9804
9864
  text = text.replace(whitespaceRE$1, ' ');
9805
9865
  }
@@ -10660,7 +10720,7 @@
10660
10720
 
10661
10721
  /* */
10662
10722
 
10663
- var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
10723
+ var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*(?:[\w$]+)?\s*\(/;
10664
10724
  var fnInvokeRE = /\([^)]*?\);*$/;
10665
10725
  var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
10666
10726
 
@@ -11162,7 +11222,7 @@
11162
11222
  // components with only scoped slots to skip forced updates from parent.
11163
11223
  // but in some cases we have to bail-out of this optimization
11164
11224
  // for example if the slot contains dynamic names, has v-if or v-for on them...
11165
- var needsForceUpdate = Object.keys(slots).some(function (key) {
11225
+ var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
11166
11226
  var slot = slots[key];
11167
11227
  return (
11168
11228
  slot.slotTargetDynamic ||
@@ -11171,22 +11231,49 @@
11171
11231
  containsSlotChild(slot) // is passing down slot from parent which may be dynamic
11172
11232
  )
11173
11233
  });
11174
- // OR when it is inside another scoped slot (the reactivity is disconnected)
11175
- // #9438
11234
+
11235
+ // #9534: if a component with scoped slots is inside a conditional branch,
11236
+ // it's possible for the same component to be reused but with different
11237
+ // compiled slot content. To avoid that, we generate a unique key based on
11238
+ // the generated code of all the slot contents.
11239
+ var needsKey = !!el.if;
11240
+
11241
+ // OR when it is inside another scoped slot or v-for (the reactivity may be
11242
+ // disconnected due to the intermediate scope variable)
11243
+ // #9438, #9506
11244
+ // TODO: this can be further optimized by properly analyzing in-scope bindings
11245
+ // and skip force updating ones that do not actually use scope variables.
11176
11246
  if (!needsForceUpdate) {
11177
11247
  var parent = el.parent;
11178
11248
  while (parent) {
11179
- if (parent.slotScope && parent.slotScope !== emptySlotScopeToken) {
11249
+ if (
11250
+ (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
11251
+ parent.for
11252
+ ) {
11180
11253
  needsForceUpdate = true;
11181
11254
  break
11182
11255
  }
11256
+ if (parent.if) {
11257
+ needsKey = true;
11258
+ }
11183
11259
  parent = parent.parent;
11184
11260
  }
11185
11261
  }
11186
11262
 
11187
- return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
11188
- return genScopedSlot(slots[key], state)
11189
- }).join(',')) + "]" + (needsForceUpdate ? ",true" : "") + ")")
11263
+ var generatedSlots = Object.keys(slots)
11264
+ .map(function (key) { return genScopedSlot(slots[key], state); })
11265
+ .join(',');
11266
+
11267
+ return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
11268
+ }
11269
+
11270
+ function hash(str) {
11271
+ var hash = 5381;
11272
+ var i = str.length;
11273
+ while(i) {
11274
+ hash = (hash * 33) ^ str.charCodeAt(--i);
11275
+ }
11276
+ return hash >>> 0
11190
11277
  }
11191
11278
 
11192
11279
  function containsSlotChild (el) {
@@ -11521,11 +11608,13 @@
11521
11608
 
11522
11609
  function repeat$1 (str, n) {
11523
11610
  var result = '';
11524
- while (true) { // eslint-disable-line
11525
- if (n & 1) { result += str; }
11526
- n >>>= 1;
11527
- if (n <= 0) { break }
11528
- str += str;
11611
+ if (n > 0) {
11612
+ while (true) { // eslint-disable-line
11613
+ if (n & 1) { result += str; }
11614
+ n >>>= 1;
11615
+ if (n <= 0) { break }
11616
+ str += str;
11617
+ }
11529
11618
  }
11530
11619
  return result
11531
11620
  }