@vue/runtime-core 3.6.0-beta.8 → 3.6.0-beta.9

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-core v3.6.0-beta.8
2
+ * @vue/runtime-core v3.6.0-beta.9
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -402,6 +402,13 @@ function checkRecursiveUpdates(seen, fn) {
402
402
  //#endregion
403
403
  //#region packages/runtime-core/src/hmr.ts
404
404
  let isHmrUpdating = false;
405
+ const setHmrUpdating = (v) => {
406
+ try {
407
+ return isHmrUpdating;
408
+ } finally {
409
+ isHmrUpdating = v;
410
+ }
411
+ };
405
412
  const hmrDirtyComponents = /* @__PURE__ */ new Map();
406
413
  const hmrDirtyComponentsMode = /* @__PURE__ */ new Map();
407
414
  (0, _vue_shared.getGlobalThis)().__VUE_HMR_RUNTIME__ = {
@@ -908,25 +915,26 @@ const TeleportImpl = {
908
915
  mount(container, mainAnchor);
909
916
  updateCssVars(n2, true);
910
917
  }
911
- if (isTeleportDeferred(n2.props)) {
918
+ if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
912
919
  n2.el.__isMounted = false;
913
920
  queuePostRenderEffect(() => {
921
+ if (n2.el.__isMounted !== false) return;
914
922
  mountToTarget();
915
923
  delete n2.el.__isMounted;
916
924
  }, void 0, parentSuspense);
917
925
  } else mountToTarget();
918
926
  } else {
919
- if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
920
- queuePostRenderEffect(() => {
921
- TeleportImpl.process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals);
922
- }, void 0, parentSuspense);
923
- return;
924
- }
925
927
  n2.el = n1.el;
926
928
  n2.targetStart = n1.targetStart;
927
929
  const mainAnchor = n2.anchor = n1.anchor;
928
930
  const target = n2.target = n1.target;
929
931
  const targetAnchor = n2.targetAnchor = n1.targetAnchor;
932
+ if (n1.el.__isMounted === false) {
933
+ queuePostRenderEffect(() => {
934
+ TeleportImpl.process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals);
935
+ }, void 0, parentSuspense);
936
+ return;
937
+ }
930
938
  const wasDisabled = isTeleportDisabled(n1.props);
931
939
  const currentContainer = wasDisabled ? container : target;
932
940
  const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
@@ -948,11 +956,9 @@ const TeleportImpl = {
948
956
  }
949
957
  },
950
958
  remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
951
- const { shapeFlag, children, anchor, targetStart, targetAnchor, target, props } = vnode;
952
- if (target) {
953
- hostRemove(targetStart);
954
- hostRemove(targetAnchor);
955
- }
959
+ const { shapeFlag, children, anchor, targetStart, targetAnchor, props } = vnode;
960
+ if (targetStart) hostRemove(targetStart);
961
+ if (targetAnchor) hostRemove(targetAnchor);
956
962
  doRemove && hostRemove(anchor);
957
963
  if (shapeFlag & 16) {
958
964
  const shouldRemove = doRemove || !isTeleportDisabled(props);
@@ -1211,7 +1217,7 @@ function baseResolveTransitionHooks(context, props, state, instance) {
1211
1217
  callHook(hook, [el]);
1212
1218
  },
1213
1219
  enter(el) {
1214
- if (isLeaving()) return;
1220
+ if (!isHmrUpdating && isLeaving()) return;
1215
1221
  let hook = onEnter;
1216
1222
  let afterHook = onAfterEnter;
1217
1223
  let cancelHook = onEnterCancelled;
@@ -3588,15 +3594,19 @@ function hasPropValueChanged(nextProps, prevProps, key) {
3588
3594
  if (key === "style" && (0, _vue_shared.isObject)(nextProp) && (0, _vue_shared.isObject)(prevProp)) return !(0, _vue_shared.looseEqual)(nextProp, prevProp);
3589
3595
  return nextProp !== prevProp;
3590
3596
  }
3591
- function updateHOCHostEl({ vnode, parent }, el) {
3597
+ function updateHOCHostEl({ vnode, parent, suspense }, el) {
3592
3598
  while (parent && !parent.vapor) {
3593
3599
  const root = parent.subTree;
3594
- if (root.suspense && root.suspense.activeBranch === vnode) root.el = vnode.el;
3600
+ if (root.suspense && root.suspense.activeBranch === vnode) {
3601
+ root.suspense.vnode.el = root.el = el;
3602
+ vnode = root;
3603
+ }
3595
3604
  if (root === vnode) {
3596
3605
  (vnode = parent.vnode).el = el;
3597
3606
  parent = parent.parent;
3598
3607
  } else break;
3599
3608
  }
3609
+ if (suspense && suspense.activeBranch === vnode) suspense.vnode.el = el;
3600
3610
  }
3601
3611
  //#endregion
3602
3612
  //#region packages/runtime-core/src/internalObject.ts
@@ -4172,10 +4182,19 @@ function baseCreateRenderer(options, createHydrationFns) {
4172
4182
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
4173
4183
  if (transition) performTransitionEnter(el, transition, () => hostInsert(el, container, anchor), parentSuspense);
4174
4184
  else hostInsert(el, container, anchor);
4175
- if ((vnodeHook = props && props.onVnodeMounted) || dirs) queuePostRenderEffect(() => {
4176
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4177
- dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4178
- }, void 0, parentSuspense);
4185
+ if ((vnodeHook = props && props.onVnodeMounted) || dirs) {
4186
+ const isHmr = isHmrUpdating;
4187
+ queuePostRenderEffect(() => {
4188
+ let prev;
4189
+ prev = setHmrUpdating(isHmr);
4190
+ try {
4191
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4192
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4193
+ } finally {
4194
+ setHmrUpdating(prev);
4195
+ }
4196
+ }, void 0, parentSuspense);
4197
+ }
4179
4198
  };
4180
4199
  const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
4181
4200
  if (scopeId) hostSetScopeId(el, scopeId);
@@ -4648,7 +4667,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4648
4667
  else hostInsert(el, container, anchor);
4649
4668
  };
4650
4669
  const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
4651
- const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex } = vnode;
4670
+ const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex, memo } = vnode;
4652
4671
  if (patchFlag === -2) optimized = false;
4653
4672
  if (ref != null) {
4654
4673
  const prevSub = (0, _vue_reactivity.setActiveSub)();
@@ -4686,9 +4705,11 @@ function baseCreateRenderer(options, createHydrationFns) {
4686
4705
  }
4687
4706
  if (doRemove) remove(vnode);
4688
4707
  }
4689
- if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) queuePostRenderEffect(() => {
4708
+ const shouldInvalidateMemo = memo != null && cacheIndex == null;
4709
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs || shouldInvalidateMemo) queuePostRenderEffect(() => {
4690
4710
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4691
4711
  shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
4712
+ if (shouldInvalidateMemo) vnode.el = null;
4692
4713
  }, void 0, parentSuspense);
4693
4714
  };
4694
4715
  const remove = (vnode) => {
@@ -5041,6 +5062,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5041
5062
  pendingId: suspenseId++,
5042
5063
  timeout: typeof timeout === "number" ? timeout : -1,
5043
5064
  activeBranch: null,
5065
+ isFallbackMountPending: false,
5044
5066
  pendingBranch: null,
5045
5067
  isInFallback: !isHydrating,
5046
5068
  isHydrating,
@@ -5061,13 +5083,14 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5061
5083
  if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
5062
5084
  }
5063
5085
  };
5064
- if (activeBranch) {
5086
+ if (activeBranch && !suspense.isFallbackMountPending) {
5065
5087
  if (parentNode(activeBranch.el) === container) anchor = next(activeBranch);
5066
5088
  unmount(activeBranch, parentComponent, suspense, true);
5067
5089
  if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
5068
5090
  }
5069
5091
  if (!delayEnter) move(pendingBranch, container, anchor, 0, parentComponent);
5070
5092
  }
5093
+ suspense.isFallbackMountPending = false;
5071
5094
  setActiveBranch(suspense, pendingBranch);
5072
5095
  suspense.pendingBranch = null;
5073
5096
  suspense.isInFallback = false;
@@ -5097,12 +5120,16 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5097
5120
  triggerEvent(vnode, "onFallback");
5098
5121
  const anchor = next(activeBranch);
5099
5122
  const mountFallback = () => {
5123
+ suspense.isFallbackMountPending = false;
5100
5124
  if (!suspense.isInFallback) return;
5101
5125
  patch(null, fallbackVNode, container, anchor, parentComponent, null, namespace, slotScopeIds, optimized);
5102
5126
  setActiveBranch(suspense, fallbackVNode);
5103
5127
  };
5104
5128
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
5105
- if (delayEnter) activeBranch.transition.afterLeave = mountFallback;
5129
+ if (delayEnter) {
5130
+ suspense.isFallbackMountPending = true;
5131
+ activeBranch.transition.afterLeave = mountFallback;
5132
+ }
5106
5133
  suspense.isInFallback = true;
5107
5134
  unmount(activeBranch, parentComponent, null, true);
5108
5135
  if (!delayEnter) mountFallback();
@@ -5503,6 +5530,7 @@ function mergeProps(...args) {
5503
5530
  const existing = ret[key];
5504
5531
  const incoming = toMerge[key];
5505
5532
  if (incoming && existing !== incoming && !((0, _vue_shared.isArray)(existing) && existing.includes(incoming))) ret[key] = existing ? [].concat(existing, incoming) : incoming;
5533
+ else if (incoming == null && existing == null && !(0, _vue_shared.isModelListener)(key)) ret[key] = incoming;
5506
5534
  } else if (key !== "") ret[key] = toMerge[key];
5507
5535
  }
5508
5536
  return ret;
@@ -6079,7 +6107,7 @@ function isMemoSame(cached, memo) {
6079
6107
  }
6080
6108
  //#endregion
6081
6109
  //#region packages/runtime-core/src/index.ts
6082
- const version = "3.6.0-beta.8";
6110
+ const version = "3.6.0-beta.9";
6083
6111
  const warn = warn$1;
6084
6112
  /**
6085
6113
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-core v3.6.0-beta.8
2
+ * @vue/runtime-core v3.6.0-beta.9
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -569,25 +569,26 @@ const TeleportImpl = {
569
569
  mount(container, mainAnchor);
570
570
  updateCssVars(n2, true);
571
571
  }
572
- if (isTeleportDeferred(n2.props)) {
572
+ if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
573
573
  n2.el.__isMounted = false;
574
574
  queuePostRenderEffect(() => {
575
+ if (n2.el.__isMounted !== false) return;
575
576
  mountToTarget();
576
577
  delete n2.el.__isMounted;
577
578
  }, void 0, parentSuspense);
578
579
  } else mountToTarget();
579
580
  } else {
580
- if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
581
- queuePostRenderEffect(() => {
582
- TeleportImpl.process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals);
583
- }, void 0, parentSuspense);
584
- return;
585
- }
586
581
  n2.el = n1.el;
587
582
  n2.targetStart = n1.targetStart;
588
583
  const mainAnchor = n2.anchor = n1.anchor;
589
584
  const target = n2.target = n1.target;
590
585
  const targetAnchor = n2.targetAnchor = n1.targetAnchor;
586
+ if (n1.el.__isMounted === false) {
587
+ queuePostRenderEffect(() => {
588
+ TeleportImpl.process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals);
589
+ }, void 0, parentSuspense);
590
+ return;
591
+ }
591
592
  const wasDisabled = isTeleportDisabled(n1.props);
592
593
  const currentContainer = wasDisabled ? container : target;
593
594
  const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
@@ -608,11 +609,9 @@ const TeleportImpl = {
608
609
  }
609
610
  },
610
611
  remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
611
- const { shapeFlag, children, anchor, targetStart, targetAnchor, target, props } = vnode;
612
- if (target) {
613
- hostRemove(targetStart);
614
- hostRemove(targetAnchor);
615
- }
612
+ const { shapeFlag, children, anchor, targetStart, targetAnchor, props } = vnode;
613
+ if (targetStart) hostRemove(targetStart);
614
+ if (targetAnchor) hostRemove(targetAnchor);
616
615
  doRemove && hostRemove(anchor);
617
616
  if (shapeFlag & 16) {
618
617
  const shouldRemove = doRemove || !isTeleportDisabled(props);
@@ -2823,15 +2822,19 @@ function hasPropValueChanged(nextProps, prevProps, key) {
2823
2822
  if (key === "style" && (0, _vue_shared.isObject)(nextProp) && (0, _vue_shared.isObject)(prevProp)) return !(0, _vue_shared.looseEqual)(nextProp, prevProp);
2824
2823
  return nextProp !== prevProp;
2825
2824
  }
2826
- function updateHOCHostEl({ vnode, parent }, el) {
2825
+ function updateHOCHostEl({ vnode, parent, suspense }, el) {
2827
2826
  while (parent && !parent.vapor) {
2828
2827
  const root = parent.subTree;
2829
- if (root.suspense && root.suspense.activeBranch === vnode) root.el = vnode.el;
2828
+ if (root.suspense && root.suspense.activeBranch === vnode) {
2829
+ root.suspense.vnode.el = root.el = el;
2830
+ vnode = root;
2831
+ }
2830
2832
  if (root === vnode) {
2831
2833
  (vnode = parent.vnode).el = el;
2832
2834
  parent = parent.parent;
2833
2835
  } else break;
2834
2836
  }
2837
+ if (suspense && suspense.activeBranch === vnode) suspense.vnode.el = el;
2835
2838
  }
2836
2839
  //#endregion
2837
2840
  //#region packages/runtime-core/src/internalObject.ts
@@ -3230,8 +3233,10 @@ function baseCreateRenderer(options, createHydrationFns) {
3230
3233
  if (transition) performTransitionEnter(el, transition, () => hostInsert(el, container, anchor), parentSuspense);
3231
3234
  else hostInsert(el, container, anchor);
3232
3235
  if ((vnodeHook = props && props.onVnodeMounted) || dirs) queuePostRenderEffect(() => {
3233
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
3234
- dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
3236
+ try {
3237
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
3238
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
3239
+ } finally {}
3235
3240
  }, void 0, parentSuspense);
3236
3241
  };
3237
3242
  const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
@@ -3659,7 +3664,7 @@ function baseCreateRenderer(options, createHydrationFns) {
3659
3664
  else hostInsert(el, container, anchor);
3660
3665
  };
3661
3666
  const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
3662
- const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex } = vnode;
3667
+ const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex, memo } = vnode;
3663
3668
  if (patchFlag === -2) optimized = false;
3664
3669
  if (ref != null) {
3665
3670
  const prevSub = (0, _vue_reactivity.setActiveSub)();
@@ -3697,9 +3702,11 @@ function baseCreateRenderer(options, createHydrationFns) {
3697
3702
  }
3698
3703
  if (doRemove) remove(vnode);
3699
3704
  }
3700
- if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) queuePostRenderEffect(() => {
3705
+ const shouldInvalidateMemo = memo != null && cacheIndex == null;
3706
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs || shouldInvalidateMemo) queuePostRenderEffect(() => {
3701
3707
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
3702
3708
  shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
3709
+ if (shouldInvalidateMemo) vnode.el = null;
3703
3710
  }, void 0, parentSuspense);
3704
3711
  };
3705
3712
  const remove = (vnode) => {
@@ -4029,6 +4036,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
4029
4036
  pendingId: suspenseId++,
4030
4037
  timeout: typeof timeout === "number" ? timeout : -1,
4031
4038
  activeBranch: null,
4039
+ isFallbackMountPending: false,
4032
4040
  pendingBranch: null,
4033
4041
  isInFallback: !isHydrating,
4034
4042
  isHydrating,
@@ -4047,13 +4055,14 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
4047
4055
  if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
4048
4056
  }
4049
4057
  };
4050
- if (activeBranch) {
4058
+ if (activeBranch && !suspense.isFallbackMountPending) {
4051
4059
  if (parentNode(activeBranch.el) === container) anchor = next(activeBranch);
4052
4060
  unmount(activeBranch, parentComponent, suspense, true);
4053
4061
  if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
4054
4062
  }
4055
4063
  if (!delayEnter) move(pendingBranch, container, anchor, 0, parentComponent);
4056
4064
  }
4065
+ suspense.isFallbackMountPending = false;
4057
4066
  setActiveBranch(suspense, pendingBranch);
4058
4067
  suspense.pendingBranch = null;
4059
4068
  suspense.isInFallback = false;
@@ -4083,12 +4092,16 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
4083
4092
  triggerEvent(vnode, "onFallback");
4084
4093
  const anchor = next(activeBranch);
4085
4094
  const mountFallback = () => {
4095
+ suspense.isFallbackMountPending = false;
4086
4096
  if (!suspense.isInFallback) return;
4087
4097
  patch(null, fallbackVNode, container, anchor, parentComponent, null, namespace, slotScopeIds, optimized);
4088
4098
  setActiveBranch(suspense, fallbackVNode);
4089
4099
  };
4090
4100
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
4091
- if (delayEnter) activeBranch.transition.afterLeave = mountFallback;
4101
+ if (delayEnter) {
4102
+ suspense.isFallbackMountPending = true;
4103
+ activeBranch.transition.afterLeave = mountFallback;
4104
+ }
4092
4105
  suspense.isInFallback = true;
4093
4106
  unmount(activeBranch, parentComponent, null, true);
4094
4107
  if (!delayEnter) mountFallback();
@@ -4454,6 +4467,7 @@ function mergeProps(...args) {
4454
4467
  const existing = ret[key];
4455
4468
  const incoming = toMerge[key];
4456
4469
  if (incoming && existing !== incoming && !((0, _vue_shared.isArray)(existing) && existing.includes(incoming))) ret[key] = existing ? [].concat(existing, incoming) : incoming;
4470
+ else if (incoming == null && existing == null && !(0, _vue_shared.isModelListener)(key)) ret[key] = incoming;
4457
4471
  } else if (key !== "") ret[key] = toMerge[key];
4458
4472
  }
4459
4473
  return ret;
@@ -4785,7 +4799,7 @@ function isMemoSame(cached, memo) {
4785
4799
  }
4786
4800
  //#endregion
4787
4801
  //#region packages/runtime-core/src/index.ts
4788
- const version = "3.6.0-beta.8";
4802
+ const version = "3.6.0-beta.9";
4789
4803
  const warn = _vue_shared.NOOP;
4790
4804
  /**
4791
4805
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -497,6 +497,10 @@ export interface SuspenseProps {
497
497
  onResolve?: () => void;
498
498
  onPending?: () => void;
499
499
  onFallback?: () => void;
500
+ /**
501
+ * Switch to fallback content if it takes longer than `timeout` milliseconds to render the new default content.
502
+ * A `timeout` value of `0` will cause the fallback content to be displayed immediately when default content is replaced.
503
+ */
500
504
  timeout?: string | number;
501
505
  /**
502
506
  * Allow suspense to be captured by parent suspense
@@ -530,6 +534,7 @@ export interface SuspenseBoundary {
530
534
  container: RendererElement;
531
535
  hiddenContainer: RendererElement;
532
536
  activeBranch: VNode | null;
537
+ isFallbackMountPending: boolean;
533
538
  pendingBranch: VNode | null;
534
539
  deps: number;
535
540
  pendingId: number;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-core v3.6.0-beta.8
2
+ * @vue/runtime-core v3.6.0-beta.9
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -408,6 +408,13 @@ function checkRecursiveUpdates(seen, fn) {
408
408
  //#endregion
409
409
  //#region packages/runtime-core/src/hmr.ts
410
410
  let isHmrUpdating = false;
411
+ const setHmrUpdating = (v) => {
412
+ try {
413
+ return isHmrUpdating;
414
+ } finally {
415
+ isHmrUpdating = v;
416
+ }
417
+ };
411
418
  const hmrDirtyComponents = /* @__PURE__ */ new Map();
412
419
  const hmrDirtyComponentsMode = /* @__PURE__ */ new Map();
413
420
  if (!!(process.env.NODE_ENV !== "production")) getGlobalThis().__VUE_HMR_RUNTIME__ = {
@@ -916,25 +923,26 @@ const TeleportImpl = {
916
923
  mount(container, mainAnchor);
917
924
  updateCssVars(n2, true);
918
925
  }
919
- if (isTeleportDeferred(n2.props)) {
926
+ if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
920
927
  n2.el.__isMounted = false;
921
928
  queuePostRenderEffect(() => {
929
+ if (n2.el.__isMounted !== false) return;
922
930
  mountToTarget();
923
931
  delete n2.el.__isMounted;
924
932
  }, void 0, parentSuspense);
925
933
  } else mountToTarget();
926
934
  } else {
927
- if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
928
- queuePostRenderEffect(() => {
929
- TeleportImpl.process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals);
930
- }, void 0, parentSuspense);
931
- return;
932
- }
933
935
  n2.el = n1.el;
934
936
  n2.targetStart = n1.targetStart;
935
937
  const mainAnchor = n2.anchor = n1.anchor;
936
938
  const target = n2.target = n1.target;
937
939
  const targetAnchor = n2.targetAnchor = n1.targetAnchor;
940
+ if (n1.el.__isMounted === false) {
941
+ queuePostRenderEffect(() => {
942
+ TeleportImpl.process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals);
943
+ }, void 0, parentSuspense);
944
+ return;
945
+ }
938
946
  const wasDisabled = isTeleportDisabled(n1.props);
939
947
  const currentContainer = wasDisabled ? container : target;
940
948
  const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
@@ -956,11 +964,9 @@ const TeleportImpl = {
956
964
  }
957
965
  },
958
966
  remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
959
- const { shapeFlag, children, anchor, targetStart, targetAnchor, target, props } = vnode;
960
- if (target) {
961
- hostRemove(targetStart);
962
- hostRemove(targetAnchor);
963
- }
967
+ const { shapeFlag, children, anchor, targetStart, targetAnchor, props } = vnode;
968
+ if (targetStart) hostRemove(targetStart);
969
+ if (targetAnchor) hostRemove(targetAnchor);
964
970
  doRemove && hostRemove(anchor);
965
971
  if (shapeFlag & 16) {
966
972
  const shouldRemove = doRemove || !isTeleportDisabled(props);
@@ -1220,7 +1226,7 @@ function baseResolveTransitionHooks(context, props, state, instance) {
1220
1226
  callHook(hook, [el]);
1221
1227
  },
1222
1228
  enter(el) {
1223
- if (isLeaving()) return;
1229
+ if (!isHmrUpdating && isLeaving()) return;
1224
1230
  let hook = onEnter;
1225
1231
  let afterHook = onAfterEnter;
1226
1232
  let cancelHook = onEnterCancelled;
@@ -3636,15 +3642,19 @@ function hasPropValueChanged(nextProps, prevProps, key) {
3636
3642
  if (key === "style" && isObject(nextProp) && isObject(prevProp)) return !looseEqual(nextProp, prevProp);
3637
3643
  return nextProp !== prevProp;
3638
3644
  }
3639
- function updateHOCHostEl({ vnode, parent }, el) {
3645
+ function updateHOCHostEl({ vnode, parent, suspense }, el) {
3640
3646
  while (parent && !parent.vapor) {
3641
3647
  const root = parent.subTree;
3642
- if (root.suspense && root.suspense.activeBranch === vnode) root.el = vnode.el;
3648
+ if (root.suspense && root.suspense.activeBranch === vnode) {
3649
+ root.suspense.vnode.el = root.el = el;
3650
+ vnode = root;
3651
+ }
3643
3652
  if (root === vnode) {
3644
3653
  (vnode = parent.vnode).el = el;
3645
3654
  parent = parent.parent;
3646
3655
  } else break;
3647
3656
  }
3657
+ if (suspense && suspense.activeBranch === vnode) suspense.vnode.el = el;
3648
3658
  }
3649
3659
  //#endregion
3650
3660
  //#region packages/runtime-core/src/internalObject.ts
@@ -4252,10 +4262,19 @@ function baseCreateRenderer(options, createHydrationFns) {
4252
4262
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
4253
4263
  if (transition) performTransitionEnter(el, transition, () => hostInsert(el, container, anchor), parentSuspense);
4254
4264
  else hostInsert(el, container, anchor);
4255
- if ((vnodeHook = props && props.onVnodeMounted) || dirs) queuePostRenderEffect(() => {
4256
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4257
- dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4258
- }, void 0, parentSuspense);
4265
+ if ((vnodeHook = props && props.onVnodeMounted) || dirs) {
4266
+ const isHmr = !!(process.env.NODE_ENV !== "production") && isHmrUpdating;
4267
+ queuePostRenderEffect(() => {
4268
+ let prev;
4269
+ if (!!(process.env.NODE_ENV !== "production")) prev = setHmrUpdating(isHmr);
4270
+ try {
4271
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4272
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4273
+ } finally {
4274
+ if (!!(process.env.NODE_ENV !== "production")) setHmrUpdating(prev);
4275
+ }
4276
+ }, void 0, parentSuspense);
4277
+ }
4259
4278
  };
4260
4279
  const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
4261
4280
  if (scopeId) hostSetScopeId(el, scopeId);
@@ -4735,7 +4754,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4735
4754
  else hostInsert(el, container, anchor);
4736
4755
  };
4737
4756
  const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
4738
- const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex } = vnode;
4757
+ const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex, memo } = vnode;
4739
4758
  if (patchFlag === -2) optimized = false;
4740
4759
  if (ref != null) {
4741
4760
  const prevSub = setActiveSub();
@@ -4773,9 +4792,11 @@ function baseCreateRenderer(options, createHydrationFns) {
4773
4792
  }
4774
4793
  if (doRemove) remove(vnode);
4775
4794
  }
4776
- if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) queuePostRenderEffect(() => {
4795
+ const shouldInvalidateMemo = memo != null && cacheIndex == null;
4796
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs || shouldInvalidateMemo) queuePostRenderEffect(() => {
4777
4797
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4778
4798
  shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
4799
+ if (shouldInvalidateMemo) vnode.el = null;
4779
4800
  }, void 0, parentSuspense);
4780
4801
  };
4781
4802
  const remove = (vnode) => {
@@ -5128,6 +5149,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5128
5149
  pendingId: suspenseId++,
5129
5150
  timeout: typeof timeout === "number" ? timeout : -1,
5130
5151
  activeBranch: null,
5152
+ isFallbackMountPending: false,
5131
5153
  pendingBranch: null,
5132
5154
  isInFallback: !isHydrating,
5133
5155
  isHydrating,
@@ -5150,13 +5172,14 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5150
5172
  if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
5151
5173
  }
5152
5174
  };
5153
- if (activeBranch) {
5175
+ if (activeBranch && !suspense.isFallbackMountPending) {
5154
5176
  if (parentNode(activeBranch.el) === container) anchor = next(activeBranch);
5155
5177
  unmount(activeBranch, parentComponent, suspense, true);
5156
5178
  if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
5157
5179
  }
5158
5180
  if (!delayEnter) move(pendingBranch, container, anchor, 0, parentComponent);
5159
5181
  }
5182
+ suspense.isFallbackMountPending = false;
5160
5183
  setActiveBranch(suspense, pendingBranch);
5161
5184
  suspense.pendingBranch = null;
5162
5185
  suspense.isInFallback = false;
@@ -5186,12 +5209,16 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5186
5209
  triggerEvent(vnode, "onFallback");
5187
5210
  const anchor = next(activeBranch);
5188
5211
  const mountFallback = () => {
5212
+ suspense.isFallbackMountPending = false;
5189
5213
  if (!suspense.isInFallback) return;
5190
5214
  patch(null, fallbackVNode, container, anchor, parentComponent, null, namespace, slotScopeIds, optimized);
5191
5215
  setActiveBranch(suspense, fallbackVNode);
5192
5216
  };
5193
5217
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
5194
- if (delayEnter) activeBranch.transition.afterLeave = mountFallback;
5218
+ if (delayEnter) {
5219
+ suspense.isFallbackMountPending = true;
5220
+ activeBranch.transition.afterLeave = mountFallback;
5221
+ }
5195
5222
  suspense.isInFallback = true;
5196
5223
  unmount(activeBranch, parentComponent, null, true);
5197
5224
  if (!delayEnter) mountFallback();
@@ -5592,6 +5619,7 @@ function mergeProps(...args) {
5592
5619
  const existing = ret[key];
5593
5620
  const incoming = toMerge[key];
5594
5621
  if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) ret[key] = existing ? [].concat(existing, incoming) : incoming;
5622
+ else if (incoming == null && existing == null && !isModelListener(key)) ret[key] = incoming;
5595
5623
  } else if (key !== "") ret[key] = toMerge[key];
5596
5624
  }
5597
5625
  return ret;
@@ -6187,7 +6215,7 @@ function isMemoSame(cached, memo) {
6187
6215
  }
6188
6216
  //#endregion
6189
6217
  //#region packages/runtime-core/src/index.ts
6190
- const version = "3.6.0-beta.8";
6218
+ const version = "3.6.0-beta.9";
6191
6219
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
6192
6220
  /**
6193
6221
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -6222,4 +6250,4 @@ const resolveFilter = null;
6222
6250
  const compatUtils = null;
6223
6251
  const DeprecationTypes = null;
6224
6252
  //#endregion
6225
- export { BaseTransition, BaseTransitionPropsValidators, Comment, DeprecationTypes, EffectScope, ErrorCodes, ErrorTypeStrings, Fragment, KeepAlive, MismatchTypes, MoveType, NULL_DYNAMIC_COMPONENT, ReactiveEffect, SchedulerJobFlags, Static, Suspense, Teleport, Text, TrackOpTypes, TriggerOpTypes, activate, assertNumber, baseEmit, baseNormalizePropsOptions, baseResolveTransitionHooks, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, checkTransitionMode, cloneVNode, compatUtils, computed, createAppAPI, createAsyncComponentContext, createBlock, createCanSetSetupRefChecker, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createInternalObject, createPropsRestProxy, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, currentInstance, customRef, deactivate, defineAsyncComponent, defineComponent, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSlots, devtools, devtoolsComponentAdded, effect, effectScope, endMeasure, ensureVaporSlotFallback, expose, flushOnAppMount, getAttributeMismatch, getComponentName, getCurrentInstance, getCurrentScope, getCurrentWatcher, getFunctionalFallthrough, getInheritedScopeIds, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrateOnIdle, hydrateOnInteraction, hydrateOnMediaQuery, hydrateOnVisible, initCustomFormatter, initFeatureFlags, inject, isAsyncWrapper, isEmitListener, isHydrating, isKeepAlive, isMapEqual, isMemoSame, isMismatchAllowed, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isSetEqual, isShallow, isTeleportDeferred, isTeleportDisabled, isTemplateNode, isTemplateRefKey, isVNode, isValidHtmlOrSvgAttribute, knownTemplateRefs, leaveCbKey, markAsyncBoundary, markRaw, matches, mergeDefaults, mergeModels, mergeProps, nextTick, nextUid, normalizeClass, normalizeProps, normalizeRef, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, onWatcherCleanup, openBlock, performAsyncHydrate, performTransitionEnter, performTransitionLeave, popScopeId, popWarningContext, provide, proxyRefs, pushScopeId, pushWarningContext, queueJob, queuePostFlushCb, reactive, readonly, ref, registerHMR, registerRuntimeCompiler, renderList, renderSlot, resetShapeFlag, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolvePropValue, resolveTarget as resolveTeleportTarget, resolveTransitionHooks, setBlockTracking, setCurrentInstance, setCurrentRenderingInstance, setDevtoolsHook, setIsHydratingEnabled, setRef, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, simpleSetCurrentInstance, ssrContextKey, ssrUtils, startMeasure, stop, toClassSet, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toStyleMap, toValue, transformVNodeArgs, triggerRef, unref, unregisterHMR, useAsyncComponentState, useAttrs, useId, useInstanceOption, useModel, useSSRContext, useSlots, useTemplateRef, useTransitionState, validateComponentName, validateProps, version, warn, warnExtraneousAttributes, warnPropMismatch, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withMemo, withScopeId };
6253
+ export { BaseTransition, BaseTransitionPropsValidators, Comment, DeprecationTypes, EffectScope, ErrorCodes, ErrorTypeStrings, Fragment, KeepAlive, MismatchTypes, MoveType, NULL_DYNAMIC_COMPONENT, ReactiveEffect, SchedulerJobFlags, Static, Suspense, Teleport, Text, TrackOpTypes, TriggerOpTypes, activate, assertNumber, baseEmit, baseNormalizePropsOptions, baseResolveTransitionHooks, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, checkTransitionMode, cloneVNode, compatUtils, computed, createAppAPI, createAsyncComponentContext, createBlock, createCanSetSetupRefChecker, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createInternalObject, createPropsRestProxy, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, currentInstance, customRef, deactivate, defineAsyncComponent, defineComponent, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSlots, devtools, devtoolsComponentAdded, effect, effectScope, endMeasure, ensureVaporSlotFallback, expose, flushOnAppMount, getAttributeMismatch, getComponentName, getCurrentInstance, getCurrentScope, getCurrentWatcher, getFunctionalFallthrough, getInheritedScopeIds, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrateOnIdle, hydrateOnInteraction, hydrateOnMediaQuery, hydrateOnVisible, initCustomFormatter, initFeatureFlags, inject, invalidateMount, invokeDirectiveHook, isAsyncWrapper, isEmitListener, isHydrating, isKeepAlive, isMapEqual, isMemoSame, isMismatchAllowed, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isSetEqual, isShallow, isTeleportDeferred, isTeleportDisabled, isTemplateNode, isTemplateRefKey, isVNode, isValidHtmlOrSvgAttribute, knownTemplateRefs, leaveCbKey, markAsyncBoundary, markRaw, matches, mergeDefaults, mergeModels, mergeProps, nextTick, nextUid, normalizeClass, normalizeProps, normalizeRef, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, onWatcherCleanup, openBlock, performAsyncHydrate, performTransitionEnter, performTransitionLeave, popScopeId, popWarningContext, provide, proxyRefs, pushScopeId, pushWarningContext, queueJob, queuePostFlushCb, reactive, readonly, ref, registerHMR, registerRuntimeCompiler, renderList, renderSlot, resetShapeFlag, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolvePropValue, resolveTarget as resolveTeleportTarget, resolveTransitionHooks, setBlockTracking, setCurrentInstance, setCurrentRenderingInstance, setDevtoolsHook, setIsHydratingEnabled, setRef, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, shouldUpdateComponent, simpleSetCurrentInstance, ssrContextKey, ssrUtils, startMeasure, stop, toClassSet, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toStyleMap, toValue, transformVNodeArgs, triggerRef, unref, unregisterHMR, useAsyncComponentState, useAttrs, useId, useInstanceOption, useModel, useSSRContext, useSlots, useTemplateRef, useTransitionState, validateComponentName, validateProps, version, warn, warnExtraneousAttributes, warnPropMismatch, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withMemo, withScopeId };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/runtime-core",
3
- "version": "3.6.0-beta.8",
3
+ "version": "3.6.0-beta.9",
4
4
  "description": "@vue/runtime-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/runtime-core.esm-bundler.js",
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
48
48
  "dependencies": {
49
- "@vue/shared": "3.6.0-beta.8",
50
- "@vue/reactivity": "3.6.0-beta.8"
49
+ "@vue/shared": "3.6.0-beta.9",
50
+ "@vue/reactivity": "3.6.0-beta.9"
51
51
  }
52
52
  }