@vue/compat 3.3.7 → 3.4.0-alpha.1

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.
@@ -419,117 +419,120 @@ function onScopeDispose(fn) {
419
419
  }
420
420
  }
421
421
 
422
- const createDep = (effects) => {
423
- const dep = new Set(effects);
424
- dep.w = 0;
425
- dep.n = 0;
426
- return dep;
427
- };
428
- const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
429
- const newTracked = (dep) => (dep.n & trackOpBit) > 0;
430
- const initDepMarkers = ({ deps }) => {
431
- if (deps.length) {
432
- for (let i = 0; i < deps.length; i++) {
433
- deps[i].w |= trackOpBit;
434
- }
435
- }
436
- };
437
- const finalizeDepMarkers = (effect) => {
438
- const { deps } = effect;
439
- if (deps.length) {
440
- let ptr = 0;
441
- for (let i = 0; i < deps.length; i++) {
442
- const dep = deps[i];
443
- if (wasTracked(dep) && !newTracked(dep)) {
444
- dep.delete(effect);
445
- } else {
446
- deps[ptr++] = dep;
447
- }
448
- dep.w &= ~trackOpBit;
449
- dep.n &= ~trackOpBit;
450
- }
451
- deps.length = ptr;
452
- }
453
- };
454
-
455
- const targetMap = /* @__PURE__ */ new WeakMap();
456
- let effectTrackDepth = 0;
457
- let trackOpBit = 1;
458
- const maxMarkerBits = 30;
459
422
  let activeEffect;
460
- const ITERATE_KEY = Symbol("iterate" );
461
- const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
462
423
  class ReactiveEffect {
463
- constructor(fn, scheduler = null, scope) {
424
+ constructor(fn, trigger, scheduler, scope) {
464
425
  this.fn = fn;
426
+ this.trigger = trigger;
465
427
  this.scheduler = scheduler;
466
428
  this.active = true;
467
429
  this.deps = [];
468
- this.parent = void 0;
430
+ /**
431
+ * @internal
432
+ */
433
+ this._dirtyLevel = 3;
434
+ /**
435
+ * @internal
436
+ */
437
+ this._trackId = 0;
438
+ /**
439
+ * @internal
440
+ */
441
+ this._runnings = 0;
442
+ /**
443
+ * @internal
444
+ */
445
+ this._queryings = 0;
446
+ /**
447
+ * @internal
448
+ */
449
+ this._depsLength = 0;
469
450
  recordEffectScope(this, scope);
470
451
  }
452
+ get dirty() {
453
+ if (this._dirtyLevel === 1) {
454
+ this._dirtyLevel = 0;
455
+ this._queryings++;
456
+ pauseTracking();
457
+ for (const dep of this.deps) {
458
+ if (dep.computed) {
459
+ triggerComputed(dep.computed);
460
+ if (this._dirtyLevel >= 2) {
461
+ break;
462
+ }
463
+ }
464
+ }
465
+ resetTracking();
466
+ this._queryings--;
467
+ }
468
+ return this._dirtyLevel >= 2;
469
+ }
470
+ set dirty(v) {
471
+ this._dirtyLevel = v ? 3 : 0;
472
+ }
471
473
  run() {
474
+ this._dirtyLevel = 0;
472
475
  if (!this.active) {
473
476
  return this.fn();
474
477
  }
475
- let parent = activeEffect;
476
478
  let lastShouldTrack = shouldTrack;
477
- while (parent) {
478
- if (parent === this) {
479
- return;
480
- }
481
- parent = parent.parent;
482
- }
479
+ let lastEffect = activeEffect;
483
480
  try {
484
- this.parent = activeEffect;
485
- activeEffect = this;
486
481
  shouldTrack = true;
487
- trackOpBit = 1 << ++effectTrackDepth;
488
- if (effectTrackDepth <= maxMarkerBits) {
489
- initDepMarkers(this);
490
- } else {
491
- cleanupEffect(this);
492
- }
482
+ activeEffect = this;
483
+ this._runnings++;
484
+ preCleanupEffect(this);
493
485
  return this.fn();
494
486
  } finally {
495
- if (effectTrackDepth <= maxMarkerBits) {
496
- finalizeDepMarkers(this);
497
- }
498
- trackOpBit = 1 << --effectTrackDepth;
499
- activeEffect = this.parent;
487
+ postCleanupEffect(this);
488
+ this._runnings--;
489
+ activeEffect = lastEffect;
500
490
  shouldTrack = lastShouldTrack;
501
- this.parent = void 0;
502
- if (this.deferStop) {
503
- this.stop();
504
- }
505
491
  }
506
492
  }
507
493
  stop() {
508
- if (activeEffect === this) {
509
- this.deferStop = true;
510
- } else if (this.active) {
511
- cleanupEffect(this);
512
- if (this.onStop) {
513
- this.onStop();
514
- }
494
+ var _a;
495
+ if (this.active) {
496
+ preCleanupEffect(this);
497
+ postCleanupEffect(this);
498
+ (_a = this.onStop) == null ? void 0 : _a.call(this);
515
499
  this.active = false;
516
500
  }
517
501
  }
518
502
  }
519
- function cleanupEffect(effect2) {
520
- const { deps } = effect2;
521
- if (deps.length) {
522
- for (let i = 0; i < deps.length; i++) {
523
- deps[i].delete(effect2);
503
+ function triggerComputed(computed) {
504
+ return computed.value;
505
+ }
506
+ function preCleanupEffect(effect2) {
507
+ effect2._trackId++;
508
+ effect2._depsLength = 0;
509
+ }
510
+ function postCleanupEffect(effect2) {
511
+ if (effect2.deps && effect2.deps.length > effect2._depsLength) {
512
+ for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
513
+ cleanupDepEffect(effect2.deps[i], effect2);
514
+ }
515
+ effect2.deps.length = effect2._depsLength;
516
+ }
517
+ }
518
+ function cleanupDepEffect(dep, effect2) {
519
+ const trackId = dep.get(effect2);
520
+ if (trackId !== void 0 && effect2._trackId !== trackId) {
521
+ dep.delete(effect2);
522
+ if (dep.size === 0) {
523
+ dep.cleanup();
524
524
  }
525
- deps.length = 0;
526
525
  }
527
526
  }
528
527
  function effect(fn, options) {
529
528
  if (fn.effect instanceof ReactiveEffect) {
530
529
  fn = fn.effect.fn;
531
530
  }
532
- const _effect = new ReactiveEffect(fn);
531
+ const _effect = new ReactiveEffect(fn, NOOP, () => {
532
+ if (_effect.dirty) {
533
+ _effect.run();
534
+ }
535
+ });
533
536
  if (options) {
534
537
  extend(_effect, options);
535
538
  if (options.scope)
@@ -546,6 +549,7 @@ function stop(runner) {
546
549
  runner.effect.stop();
547
550
  }
548
551
  let shouldTrack = true;
552
+ let pauseScheduleStack = 0;
549
553
  const trackStack = [];
550
554
  function pauseTracking() {
551
555
  trackStack.push(shouldTrack);
@@ -555,6 +559,68 @@ function resetTracking() {
555
559
  const last = trackStack.pop();
556
560
  shouldTrack = last === void 0 ? true : last;
557
561
  }
562
+ function pauseScheduling() {
563
+ pauseScheduleStack++;
564
+ }
565
+ function resetScheduling() {
566
+ pauseScheduleStack--;
567
+ while (!pauseScheduleStack && queueEffectSchedulers.length) {
568
+ queueEffectSchedulers.shift()();
569
+ }
570
+ }
571
+ function trackEffect(effect2, dep, debuggerEventExtraInfo) {
572
+ var _a;
573
+ if (dep.get(effect2) !== effect2._trackId) {
574
+ dep.set(effect2, effect2._trackId);
575
+ const oldDep = effect2.deps[effect2._depsLength];
576
+ if (oldDep !== dep) {
577
+ if (oldDep) {
578
+ cleanupDepEffect(oldDep, effect2);
579
+ }
580
+ effect2.deps[effect2._depsLength++] = dep;
581
+ } else {
582
+ effect2._depsLength++;
583
+ }
584
+ {
585
+ (_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
586
+ }
587
+ }
588
+ }
589
+ const queueEffectSchedulers = [];
590
+ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
591
+ var _a;
592
+ pauseScheduling();
593
+ for (const effect2 of dep.keys()) {
594
+ if (!effect2.allowRecurse && effect2._runnings) {
595
+ continue;
596
+ }
597
+ if (effect2._dirtyLevel < dirtyLevel && (!effect2._runnings || dirtyLevel !== 2)) {
598
+ const lastDirtyLevel = effect2._dirtyLevel;
599
+ effect2._dirtyLevel = dirtyLevel;
600
+ if (lastDirtyLevel === 0 && (!effect2._queryings || dirtyLevel !== 2)) {
601
+ {
602
+ (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
603
+ }
604
+ effect2.trigger();
605
+ if (effect2.scheduler) {
606
+ queueEffectSchedulers.push(effect2.scheduler);
607
+ }
608
+ }
609
+ }
610
+ }
611
+ resetScheduling();
612
+ }
613
+
614
+ const createDep = (cleanup, computed) => {
615
+ const dep = /* @__PURE__ */ new Map();
616
+ dep.cleanup = cleanup;
617
+ dep.computed = computed;
618
+ return dep;
619
+ };
620
+
621
+ const targetMap = /* @__PURE__ */ new WeakMap();
622
+ const ITERATE_KEY = Symbol("iterate" );
623
+ const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
558
624
  function track(target, type, key) {
559
625
  if (shouldTrack && activeEffect) {
560
626
  let depsMap = targetMap.get(target);
@@ -563,35 +629,17 @@ function track(target, type, key) {
563
629
  }
564
630
  let dep = depsMap.get(key);
565
631
  if (!dep) {
566
- depsMap.set(key, dep = createDep());
567
- }
568
- const eventInfo = { effect: activeEffect, target, type, key } ;
569
- trackEffects(dep, eventInfo);
570
- }
571
- }
572
- function trackEffects(dep, debuggerEventExtraInfo) {
573
- let shouldTrack2 = false;
574
- if (effectTrackDepth <= maxMarkerBits) {
575
- if (!newTracked(dep)) {
576
- dep.n |= trackOpBit;
577
- shouldTrack2 = !wasTracked(dep);
578
- }
579
- } else {
580
- shouldTrack2 = !dep.has(activeEffect);
581
- }
582
- if (shouldTrack2) {
583
- dep.add(activeEffect);
584
- activeEffect.deps.push(dep);
585
- if (activeEffect.onTrack) {
586
- activeEffect.onTrack(
587
- extend(
588
- {
589
- effect: activeEffect
590
- },
591
- debuggerEventExtraInfo
592
- )
593
- );
632
+ depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
594
633
  }
634
+ trackEffect(
635
+ activeEffect,
636
+ dep,
637
+ {
638
+ target,
639
+ type,
640
+ key
641
+ }
642
+ );
595
643
  }
596
644
  }
597
645
  function trigger(target, type, key, newValue, oldValue, oldTarget) {
@@ -639,49 +687,24 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
639
687
  break;
640
688
  }
641
689
  }
642
- const eventInfo = { target, type, key, newValue, oldValue, oldTarget } ;
643
- if (deps.length === 1) {
644
- if (deps[0]) {
645
- {
646
- triggerEffects(deps[0], eventInfo);
647
- }
648
- }
649
- } else {
650
- const effects = [];
651
- for (const dep of deps) {
652
- if (dep) {
653
- effects.push(...dep);
654
- }
655
- }
656
- {
657
- triggerEffects(createDep(effects), eventInfo);
658
- }
659
- }
660
- }
661
- function triggerEffects(dep, debuggerEventExtraInfo) {
662
- const effects = isArray(dep) ? dep : [...dep];
663
- for (const effect2 of effects) {
664
- if (effect2.computed) {
665
- triggerEffect(effect2, debuggerEventExtraInfo);
666
- }
667
- }
668
- for (const effect2 of effects) {
669
- if (!effect2.computed) {
670
- triggerEffect(effect2, debuggerEventExtraInfo);
671
- }
672
- }
673
- }
674
- function triggerEffect(effect2, debuggerEventExtraInfo) {
675
- if (effect2 !== activeEffect || effect2.allowRecurse) {
676
- if (effect2.onTrigger) {
677
- effect2.onTrigger(extend({ effect: effect2 }, debuggerEventExtraInfo));
678
- }
679
- if (effect2.scheduler) {
680
- effect2.scheduler();
681
- } else {
682
- effect2.run();
690
+ pauseScheduling();
691
+ for (const dep of deps) {
692
+ if (dep) {
693
+ triggerEffects(
694
+ dep,
695
+ 3,
696
+ {
697
+ target,
698
+ type,
699
+ key,
700
+ newValue,
701
+ oldValue,
702
+ oldTarget
703
+ }
704
+ );
683
705
  }
684
706
  }
707
+ resetScheduling();
685
708
  }
686
709
  function getDepFromReactive(object, key) {
687
710
  var _a;
@@ -712,7 +735,9 @@ function createArrayInstrumentations() {
712
735
  ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
713
736
  instrumentations[key] = function(...args) {
714
737
  pauseTracking();
738
+ pauseScheduling();
715
739
  const res = toRaw(this)[key].apply(this, args);
740
+ resetScheduling();
716
741
  resetTracking();
717
742
  return res;
718
743
  };
@@ -1251,30 +1276,93 @@ function markRaw(value) {
1251
1276
  const toReactive = (value) => isObject(value) ? reactive(value) : value;
1252
1277
  const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1253
1278
 
1279
+ class ComputedRefImpl {
1280
+ constructor(getter, _setter, isReadonly, isSSR) {
1281
+ this._setter = _setter;
1282
+ this.dep = void 0;
1283
+ this.__v_isRef = true;
1284
+ this["__v_isReadonly"] = false;
1285
+ this.effect = new ReactiveEffect(getter, () => {
1286
+ triggerRefValue(this, 1);
1287
+ });
1288
+ this.effect.computed = this;
1289
+ this.effect.active = this._cacheable = !isSSR;
1290
+ this["__v_isReadonly"] = isReadonly;
1291
+ }
1292
+ get value() {
1293
+ const self = toRaw(this);
1294
+ trackRefValue(self);
1295
+ if (!self._cacheable || self.effect.dirty) {
1296
+ if (hasChanged(self._value, self._value = self.effect.run())) {
1297
+ triggerRefValue(self, 2);
1298
+ }
1299
+ }
1300
+ return self._value;
1301
+ }
1302
+ set value(newValue) {
1303
+ this._setter(newValue);
1304
+ }
1305
+ // #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
1306
+ get _dirty() {
1307
+ return this.effect.dirty;
1308
+ }
1309
+ set _dirty(v) {
1310
+ this.effect.dirty = v;
1311
+ }
1312
+ // #endregion
1313
+ }
1314
+ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1315
+ let getter;
1316
+ let setter;
1317
+ const onlyGetter = isFunction(getterOrOptions);
1318
+ if (onlyGetter) {
1319
+ getter = getterOrOptions;
1320
+ setter = () => {
1321
+ console.warn("Write operation failed: computed value is readonly");
1322
+ } ;
1323
+ } else {
1324
+ getter = getterOrOptions.get;
1325
+ setter = getterOrOptions.set;
1326
+ }
1327
+ const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
1328
+ if (debugOptions && !isSSR) {
1329
+ cRef.effect.onTrack = debugOptions.onTrack;
1330
+ cRef.effect.onTrigger = debugOptions.onTrigger;
1331
+ }
1332
+ return cRef;
1333
+ }
1334
+
1254
1335
  function trackRefValue(ref2) {
1255
1336
  if (shouldTrack && activeEffect) {
1256
1337
  ref2 = toRaw(ref2);
1257
- {
1258
- trackEffects(ref2.dep || (ref2.dep = createDep()), {
1338
+ trackEffect(
1339
+ activeEffect,
1340
+ ref2.dep || (ref2.dep = createDep(
1341
+ () => ref2.dep = void 0,
1342
+ ref2 instanceof ComputedRefImpl ? ref2 : void 0
1343
+ )),
1344
+ {
1259
1345
  target: ref2,
1260
1346
  type: "get",
1261
1347
  key: "value"
1262
- });
1263
- }
1348
+ }
1349
+ );
1264
1350
  }
1265
1351
  }
1266
- function triggerRefValue(ref2, newVal) {
1352
+ function triggerRefValue(ref2, dirtyLevel = 3, newVal) {
1267
1353
  ref2 = toRaw(ref2);
1268
1354
  const dep = ref2.dep;
1269
1355
  if (dep) {
1270
- {
1271
- triggerEffects(dep, {
1356
+ triggerEffects(
1357
+ dep,
1358
+ dirtyLevel,
1359
+ {
1272
1360
  target: ref2,
1273
1361
  type: "set",
1274
1362
  key: "value",
1275
1363
  newValue: newVal
1276
- });
1277
- }
1364
+ }
1365
+ );
1278
1366
  }
1279
1367
  }
1280
1368
  function isRef(r) {
@@ -1310,12 +1398,12 @@ class RefImpl {
1310
1398
  if (hasChanged(newVal, this._rawValue)) {
1311
1399
  this._rawValue = newVal;
1312
1400
  this._value = useDirectValue ? newVal : toReactive(newVal);
1313
- triggerRefValue(this, newVal);
1401
+ triggerRefValue(this, 3, newVal);
1314
1402
  }
1315
1403
  }
1316
1404
  }
1317
1405
  function triggerRef(ref2) {
1318
- triggerRefValue(ref2, ref2.value );
1406
+ triggerRefValue(ref2, 3, ref2.value );
1319
1407
  }
1320
1408
  function unref(ref2) {
1321
1409
  return isRef(ref2) ? ref2.value : ref2;
@@ -1413,57 +1501,6 @@ function propertyToRef(source, key, defaultValue) {
1413
1501
  return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1414
1502
  }
1415
1503
 
1416
- class ComputedRefImpl {
1417
- constructor(getter, _setter, isReadonly, isSSR) {
1418
- this._setter = _setter;
1419
- this.dep = void 0;
1420
- this.__v_isRef = true;
1421
- this["__v_isReadonly"] = false;
1422
- this._dirty = true;
1423
- this.effect = new ReactiveEffect(getter, () => {
1424
- if (!this._dirty) {
1425
- this._dirty = true;
1426
- triggerRefValue(this);
1427
- }
1428
- });
1429
- this.effect.computed = this;
1430
- this.effect.active = this._cacheable = !isSSR;
1431
- this["__v_isReadonly"] = isReadonly;
1432
- }
1433
- get value() {
1434
- const self = toRaw(this);
1435
- trackRefValue(self);
1436
- if (self._dirty || !self._cacheable) {
1437
- self._dirty = false;
1438
- self._value = self.effect.run();
1439
- }
1440
- return self._value;
1441
- }
1442
- set value(newValue) {
1443
- this._setter(newValue);
1444
- }
1445
- }
1446
- function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1447
- let getter;
1448
- let setter;
1449
- const onlyGetter = isFunction(getterOrOptions);
1450
- if (onlyGetter) {
1451
- getter = getterOrOptions;
1452
- setter = () => {
1453
- console.warn("Write operation failed: computed value is readonly");
1454
- } ;
1455
- } else {
1456
- getter = getterOrOptions.get;
1457
- setter = getterOrOptions.set;
1458
- }
1459
- const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
1460
- if (debugOptions && !isSSR) {
1461
- cRef.effect.onTrack = debugOptions.onTrack;
1462
- cRef.effect.onTrigger = debugOptions.onTrigger;
1463
- }
1464
- return cRef;
1465
- }
1466
-
1467
1504
  const stack = [];
1468
1505
  function pushWarningContext(vnode) {
1469
1506
  stack.push(vnode);
@@ -1578,7 +1615,7 @@ function assertNumber(val, type) {
1578
1615
  }
1579
1616
  }
1580
1617
 
1581
- const ErrorTypeStrings = {
1618
+ const ErrorTypeStrings$1 = {
1582
1619
  ["sp"]: "serverPrefetch hook",
1583
1620
  ["bc"]: "beforeCreate hook",
1584
1621
  ["c"]: "created hook",
@@ -1639,7 +1676,7 @@ function handleError(err, instance, type, throwInDev = true) {
1639
1676
  if (instance) {
1640
1677
  let cur = instance.parent;
1641
1678
  const exposedInstance = instance.proxy;
1642
- const errorInfo = ErrorTypeStrings[type] ;
1679
+ const errorInfo = ErrorTypeStrings$1[type] ;
1643
1680
  while (cur) {
1644
1681
  const errorCapturedHooks = cur.ec;
1645
1682
  if (errorCapturedHooks) {
@@ -1666,7 +1703,7 @@ function handleError(err, instance, type, throwInDev = true) {
1666
1703
  }
1667
1704
  function logError(err, type, contextVNode, throwInDev = true) {
1668
1705
  {
1669
- const info = ErrorTypeStrings[type];
1706
+ const info = ErrorTypeStrings$1[type];
1670
1707
  if (contextVNode) {
1671
1708
  pushWarningContext(contextVNode);
1672
1709
  }
@@ -1894,6 +1931,7 @@ function rerender(id, newRender) {
1894
1931
  }
1895
1932
  instance.renderCache = [];
1896
1933
  isHmrUpdating = true;
1934
+ instance.effect.dirty = true;
1897
1935
  instance.update();
1898
1936
  isHmrUpdating = false;
1899
1937
  });
@@ -1921,6 +1959,7 @@ function reload(id, newComp) {
1921
1959
  instance.ceReload(newComp.styles);
1922
1960
  hmrDirtyComponents.delete(oldComp);
1923
1961
  } else if (instance.parent) {
1962
+ instance.parent.effect.dirty = true;
1924
1963
  queueJob(instance.parent.update);
1925
1964
  } else if (instance.appContext.reload) {
1926
1965
  instance.appContext.reload();
@@ -3616,8 +3655,15 @@ function watch(source, cb, options) {
3616
3655
  }
3617
3656
  return doWatch(source, cb, options);
3618
3657
  }
3619
- function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) {
3658
+ function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger } = EMPTY_OBJ) {
3620
3659
  var _a;
3660
+ if (cb && once) {
3661
+ const _cb = cb;
3662
+ cb = (...args) => {
3663
+ _cb(...args);
3664
+ unwatch();
3665
+ };
3666
+ }
3621
3667
  if (!cb) {
3622
3668
  if (immediate !== void 0) {
3623
3669
  warn(
@@ -3629,6 +3675,11 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
3629
3675
  `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
3630
3676
  );
3631
3677
  }
3678
+ if (once !== void 0) {
3679
+ warn(
3680
+ `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
3681
+ );
3682
+ }
3632
3683
  }
3633
3684
  const warnInvalidSource = (s) => {
3634
3685
  warn(
@@ -3706,7 +3757,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
3706
3757
  };
3707
3758
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
3708
3759
  const job = () => {
3709
- if (!effect.active) {
3760
+ if (!effect.active || !effect.dirty) {
3710
3761
  return;
3711
3762
  }
3712
3763
  if (cb) {
@@ -3739,7 +3790,13 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
3739
3790
  job.id = instance.uid;
3740
3791
  scheduler = () => queueJob(job);
3741
3792
  }
3742
- const effect = new ReactiveEffect(getter, scheduler);
3793
+ const effect = new ReactiveEffect(getter, NOOP, scheduler);
3794
+ const unwatch = () => {
3795
+ effect.stop();
3796
+ if (instance && instance.scope) {
3797
+ remove(instance.scope.effects, effect);
3798
+ }
3799
+ };
3743
3800
  {
3744
3801
  effect.onTrack = onTrack;
3745
3802
  effect.onTrigger = onTrigger;
@@ -3758,12 +3815,6 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
3758
3815
  } else {
3759
3816
  effect.run();
3760
3817
  }
3761
- const unwatch = () => {
3762
- effect.stop();
3763
- if (instance && instance.scope) {
3764
- remove(instance.scope.effects, effect);
3765
- }
3766
- };
3767
3818
  return unwatch;
3768
3819
  }
3769
3820
  function instanceWatch(source, value, options) {
@@ -3996,6 +4047,7 @@ const BaseTransitionImpl = {
3996
4047
  leavingHooks.afterLeave = () => {
3997
4048
  state.isLeaving = false;
3998
4049
  if (instance.update.active !== false) {
4050
+ instance.effect.dirty = true;
3999
4051
  instance.update();
4000
4052
  }
4001
4053
  };
@@ -4334,6 +4386,7 @@ function defineAsyncComponent(source) {
4334
4386
  load().then(() => {
4335
4387
  loaded.value = true;
4336
4388
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
4389
+ instance.parent.effect.dirty = true;
4337
4390
  queueJob(instance.parent.update);
4338
4391
  }
4339
4392
  }).catch((err) => {
@@ -4631,7 +4684,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
4631
4684
  }
4632
4685
  return wrappedHook;
4633
4686
  } else {
4634
- const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ""));
4687
+ const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
4635
4688
  warn(
4636
4689
  `${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` )
4637
4690
  );
@@ -5353,7 +5406,10 @@ const publicPropertiesMap = (
5353
5406
  $root: (i) => getPublicInstance(i.root),
5354
5407
  $emit: (i) => i.emit,
5355
5408
  $options: (i) => resolveMergedOptions(i) ,
5356
- $forceUpdate: (i) => i.f || (i.f = () => queueJob(i.update)),
5409
+ $forceUpdate: (i) => i.f || (i.f = () => {
5410
+ i.effect.dirty = true;
5411
+ queueJob(i.update);
5412
+ }),
5357
5413
  $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
5358
5414
  $watch: (i) => instanceWatch.bind(i)
5359
5415
  })
@@ -6254,7 +6310,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6254
6310
  return vm;
6255
6311
  }
6256
6312
  }
6257
- Vue.version = `2.6.14-compat:${"3.3.7"}`;
6313
+ Vue.version = `2.6.14-compat:${"3.4.0-alpha.1"}`;
6258
6314
  Vue.config = singletonApp.config;
6259
6315
  Vue.use = (p, ...options) => {
6260
6316
  if (p && isFunction(p.install)) {
@@ -8660,6 +8716,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8660
8716
  } else {
8661
8717
  instance.next = n2;
8662
8718
  invalidateJob(instance.update);
8719
+ instance.effect.dirty = true;
8663
8720
  instance.update();
8664
8721
  }
8665
8722
  } else {
@@ -8853,11 +8910,16 @@ function baseCreateRenderer(options, createHydrationFns) {
8853
8910
  };
8854
8911
  const effect = instance.effect = new ReactiveEffect(
8855
8912
  componentUpdateFn,
8913
+ NOOP,
8856
8914
  () => queueJob(update),
8857
8915
  instance.scope
8858
8916
  // track it in component's effect scope
8859
8917
  );
8860
- const update = instance.update = () => effect.run();
8918
+ const update = instance.update = () => {
8919
+ if (effect.dirty) {
8920
+ effect.run();
8921
+ }
8922
+ };
8861
8923
  update.id = instance.uid;
8862
8924
  toggleRecurse(instance, true);
8863
8925
  {
@@ -10829,7 +10891,8 @@ function isMemoSame(cached, memo) {
10829
10891
  return true;
10830
10892
  }
10831
10893
 
10832
- const version = "3.3.7";
10894
+ const version = "3.4.0-alpha.1";
10895
+ const ErrorTypeStrings = ErrorTypeStrings$1 ;
10833
10896
  const ssrUtils = null;
10834
10897
  const resolveFilter = resolveFilter$1 ;
10835
10898
  const _compatUtils = {
@@ -12465,6 +12528,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12465
12528
  BaseTransitionPropsValidators: BaseTransitionPropsValidators,
12466
12529
  Comment: Comment,
12467
12530
  EffectScope: EffectScope,
12531
+ ErrorTypeStrings: ErrorTypeStrings,
12468
12532
  Fragment: Fragment,
12469
12533
  KeepAlive: KeepAlive,
12470
12534
  ReactiveEffect: ReactiveEffect,
@@ -17667,4 +17731,4 @@ var Vue$1 = Vue;
17667
17731
 
17668
17732
  const { configureCompat } = Vue$1;
17669
17733
 
17670
- export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, Vue$1 as default, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useModel, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };
17734
+ export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, ErrorTypeStrings, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, Vue$1 as default, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useModel, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };