@vue/reactivity 3.6.0-rc.13 → 3.6.0-rc.15

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/reactivity v3.6.0-rc.13
2
+ * @vue/reactivity v3.6.0-rc.15
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -39,16 +39,24 @@ const toRawType = (value) => {
39
39
  };
40
40
  const isPlainObject = (val) => toTypeString(val) === "[object Object]";
41
41
  const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
42
+ const STRING_CACHE_MAX_SIZE = 1e4;
42
43
  const cacheStringFunction = (fn) => {
43
- const cache = Object.create(null);
44
+ let cache = Object.create(null);
45
+ let size = 0;
44
46
  return ((str) => {
45
- return cache[str] || (cache[str] = fn(str));
47
+ const hit = cache[str];
48
+ if (hit !== void 0) return hit;
49
+ if (++size > STRING_CACHE_MAX_SIZE) {
50
+ cache = Object.create(null);
51
+ size = 1;
52
+ }
53
+ return cache[str] = fn(str);
46
54
  });
47
55
  };
48
56
  /**
49
57
  * @private
50
58
  */
51
- const capitalize = cacheStringFunction((str) => {
59
+ const capitalize = /*@__PURE__*/ cacheStringFunction((str) => {
52
60
  return str.charAt(0).toUpperCase() + str.slice(1);
53
61
  });
54
62
  const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
@@ -61,41 +69,6 @@ const def = (obj, key, value, writable = false) => {
61
69
  });
62
70
  };
63
71
  //#endregion
64
- //#region packages/reactivity/src/debug.ts
65
- const triggerEventInfos = [];
66
- function onTrack(sub, debugInfo) {
67
- if (sub.onTrack) sub.onTrack(extend({ effect: sub }, debugInfo));
68
- }
69
- function onTrigger(sub) {
70
- if (sub.onTrigger) {
71
- const debugInfo = triggerEventInfos[triggerEventInfos.length - 1];
72
- sub.onTrigger(extend({ effect: sub }, debugInfo));
73
- }
74
- }
75
- function setupOnTrigger(target) {
76
- Object.defineProperty(target.prototype, "onTrigger", {
77
- get() {
78
- return this._onTrigger;
79
- },
80
- set(val) {
81
- if (val && !this._onTrigger) setupFlagsHandler(this);
82
- this._onTrigger = val;
83
- }
84
- });
85
- }
86
- function setupFlagsHandler(target) {
87
- target._flags = target.flags;
88
- Object.defineProperty(target, "flags", {
89
- get() {
90
- return target._flags;
91
- },
92
- set(value) {
93
- if (!(target._flags & 48) && !!(value & 48)) onTrigger(this);
94
- target._flags = value;
95
- }
96
- });
97
- }
98
- //#endregion
99
72
  //#region packages/reactivity/src/warning.ts
100
73
  function warn(msg, ...args) {
101
74
  console.warn(`[Vue warn] ${msg}`, ...args);
@@ -105,13 +78,7 @@ function warn(msg, ...args) {
105
78
  const notifyBuffer = [];
106
79
  let batchDepth = 0;
107
80
  let activeSub = void 0;
108
- let runDepth = 0;
109
- function incRunDepth() {
110
- ++runDepth;
111
- }
112
- function decRunDepth() {
113
- --runDepth;
114
- }
81
+ const CHECKING = 512;
115
82
  let globalVersion = 0;
116
83
  let notifyIndex = 0;
117
84
  let notifyBufferLength = 0;
@@ -160,6 +127,7 @@ function unlink(link, sub = link.sub) {
160
127
  const nextDep = link.nextDep;
161
128
  const nextSub = link.nextSub;
162
129
  const prevSub = link.prevSub;
130
+ link.prevDep = link.nextDep = link.prevSub = link.nextSub = void 0;
163
131
  if (nextDep !== void 0) nextDep.prevDep = prevDep;
164
132
  else sub.depsTail = prevDep;
165
133
  if (prevDep !== void 0) prevDep.nextDep = nextDep;
@@ -167,7 +135,7 @@ function unlink(link, sub = link.sub) {
167
135
  if (nextSub !== void 0) nextSub.prevSub = prevSub;
168
136
  else dep.subsTail = prevSub;
169
137
  if (prevSub !== void 0) prevSub.nextSub = nextSub;
170
- else if ((dep.subs = nextSub) === void 0) {
138
+ else if ((dep.subs = nextSub) === void 0 && dep.flags & 1) {
171
139
  let toRemove = dep.deps;
172
140
  if (toRemove !== void 0) {
173
141
  do
@@ -185,14 +153,12 @@ function propagate(link) {
185
153
  const sub = link.sub;
186
154
  let flags = sub.flags;
187
155
  if (flags & 3) {
188
- if (!(flags & 60)) {
189
- sub.flags = flags | 32;
190
- if (runDepth) sub.flags |= 8;
191
- } else if (!(flags & 12)) flags = 0;
156
+ if (!(flags & 44)) sub.flags = flags | 32;
157
+ else if (!(flags & 12)) flags = 0;
192
158
  else if (!(flags & 4)) sub.flags = flags & -9 | 32;
193
159
  else if (!(flags & 48) && isValidLink(link, sub)) {
194
160
  sub.flags = flags | 40;
195
- flags &= 1;
161
+ flags = sub === activeSub || activeSub === void 0 ? 0 : flags & 1;
196
162
  } else flags = 0;
197
163
  if (flags & 2) notifyBuffer[notifyBufferLength++] = sub;
198
164
  if (flags & 1) {
@@ -228,7 +194,7 @@ function propagate(link) {
228
194
  function startTracking(sub) {
229
195
  ++globalVersion;
230
196
  sub.depsTail = void 0;
231
- sub.flags = sub.flags & -57 | 4;
197
+ sub.flags = sub.flags & -569 | 4;
232
198
  return setActiveSub(sub);
233
199
  }
234
200
  function endTracking(sub, prevSub) {
@@ -236,8 +202,11 @@ function endTracking(sub, prevSub) {
236
202
  activeSub = prevSub;
237
203
  const depsTail = sub.depsTail;
238
204
  let toRemove = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
239
- while (toRemove !== void 0) toRemove = unlink(toRemove, sub);
240
- sub.flags &= -5;
205
+ while (toRemove !== void 0) {
206
+ unlink(toRemove, sub);
207
+ toRemove = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
208
+ }
209
+ if ((sub.flags &= -5) & 8) markRecursed(sub);
241
210
  }
242
211
  function flush() {
243
212
  let hasError = false;
@@ -259,45 +228,67 @@ function flush() {
259
228
  if (hasError) throw error;
260
229
  }
261
230
  function checkDirty(link, sub) {
231
+ try {
232
+ return walkDirty(link, sub);
233
+ } catch (err) {
234
+ markStale(sub);
235
+ throw err;
236
+ }
237
+ }
238
+ function walkDirty(link, sub) {
239
+ const root = sub;
262
240
  let stack;
263
241
  let checkDepth = 0;
242
+ let staleDepth = 0;
243
+ let staleFloor = 0;
264
244
  top: do {
265
245
  const dep = link.dep;
266
246
  const depFlags = dep.flags;
267
247
  let dirty = false;
268
248
  if (sub.flags & 16) dirty = true;
269
249
  else if ((depFlags & 17) === 17) {
270
- const subs = dep.subs;
271
250
  if (dep.update()) {
272
- if (subs.nextSub !== void 0) shallowPropagate(subs);
251
+ const subs = dep.subs;
252
+ if (subs !== void 0 && (subs !== link || subs.nextSub !== void 0)) shallowPropagate(subs);
273
253
  dirty = true;
274
254
  }
275
255
  } else if ((depFlags & 33) === 33) {
276
- stack = {
277
- value: link,
278
- prev: stack
279
- };
280
- link = dep.deps;
281
- sub = dep;
282
- ++checkDepth;
283
- continue;
256
+ const depth = dep === root ? 0 : depFlags & CHECKING ? checkingDepth(dep, stack, checkDepth) : -1;
257
+ if (depth < 0) {
258
+ if (link.nextSub !== void 0 || link.prevSub !== void 0) dep.flags = depFlags | CHECKING;
259
+ stack = {
260
+ value: link,
261
+ prev: stack
262
+ };
263
+ link = dep.deps;
264
+ sub = dep;
265
+ ++checkDepth;
266
+ continue;
267
+ }
268
+ if (depth < checkDepth) {
269
+ staleFloor = staleDepth && staleFloor < depth ? staleFloor : depth;
270
+ staleDepth = checkDepth;
271
+ }
284
272
  }
285
273
  if (!dirty && link.nextDep !== void 0) {
286
274
  link = link.nextDep;
287
275
  continue;
288
276
  }
289
277
  while (checkDepth) {
278
+ const stale = checkDepth === staleDepth;
279
+ if (stale && --staleDepth === staleFloor) staleDepth = 0;
290
280
  --checkDepth;
291
281
  link = stack.value;
292
282
  stack = stack.prev;
293
283
  if (dirty) {
294
- const subs = sub.subs;
295
284
  if (sub.update()) {
296
- if (subs.nextSub !== void 0) shallowPropagate(subs);
285
+ const subs = sub.subs;
286
+ if (subs !== void 0 && (subs !== link || subs.nextSub !== void 0)) shallowPropagate(subs);
297
287
  sub = link.sub;
298
288
  continue;
299
289
  }
300
- } else sub.flags &= -33;
290
+ } else if (stale) sub.flags = sub.flags & -545 | 16;
291
+ else sub.flags &= -545;
301
292
  sub = link.sub;
302
293
  if (link.nextDep !== void 0) {
303
294
  link = link.nextDep;
@@ -305,9 +296,21 @@ function checkDirty(link, sub) {
305
296
  }
306
297
  dirty = false;
307
298
  }
308
- return dirty && !!sub.flags;
299
+ return (dirty || !!(sub.flags & 16)) && !!sub.flags;
309
300
  } while (true);
310
301
  }
302
+ function checkingDepth(dep, stack, depth) {
303
+ for (; stack !== void 0; stack = stack.prev, --depth) if (stack.value.dep === dep) return depth;
304
+ return -1;
305
+ }
306
+ function markStale(sub) {
307
+ const nodes = [sub];
308
+ do {
309
+ sub = nodes.pop();
310
+ sub.flags = sub.flags & -33 | 16;
311
+ for (let link = sub.deps; link !== void 0; link = link.nextDep) if (link.dep.flags & 32) nodes.push(link.dep);
312
+ } while (nodes.length);
313
+ }
311
314
  function shallowPropagate(link) {
312
315
  do {
313
316
  const sub = link.sub;
@@ -325,6 +328,71 @@ function isValidLink(checkLink, sub) {
325
328
  }
326
329
  return false;
327
330
  }
331
+ function markRecursed(sub) {
332
+ const nodes = [sub];
333
+ do {
334
+ sub = nodes.pop();
335
+ for (let link = sub.deps; link !== void 0; link = link.nextDep) {
336
+ const dep = link.dep;
337
+ if ((dep.flags & 40) === 32) {
338
+ dep.flags |= 8;
339
+ nodes.push(dep);
340
+ }
341
+ }
342
+ } while (nodes.length);
343
+ }
344
+ //#endregion
345
+ //#region packages/reactivity/src/debug.ts
346
+ const triggered = [];
347
+ function onTrack(sub, debugInfo) {
348
+ if (sub.onTrack) sub.onTrack(extend({ effect: sub }, debugInfo));
349
+ }
350
+ function onTrigger(sub, debugInfo) {
351
+ if (sub.onTrigger) sub.onTrigger(extend({ effect: sub }, debugInfo));
352
+ }
353
+ function startTrigger() {
354
+ triggered.push([]);
355
+ }
356
+ function endTrigger(debugInfo) {
357
+ const subs = triggered.pop();
358
+ if (subs.length) {
359
+ startBatch();
360
+ try {
361
+ for (let i = 0; i < subs.length; i++) {
362
+ const sub = subs[i];
363
+ if (sub.flags & 3) onTrigger(sub, debugInfo);
364
+ }
365
+ } finally {
366
+ endBatch();
367
+ }
368
+ }
369
+ }
370
+ function setupOnTrigger(target) {
371
+ Object.defineProperty(target.prototype, "onTrigger", {
372
+ get() {
373
+ return this._onTrigger;
374
+ },
375
+ set(val) {
376
+ if (val && !this._onTrigger) setupFlagsHandler(this);
377
+ this._onTrigger = val;
378
+ }
379
+ });
380
+ }
381
+ function setupFlagsHandler(target) {
382
+ target._flags = target.flags;
383
+ Object.defineProperty(target, "flags", {
384
+ get() {
385
+ return target._flags;
386
+ },
387
+ set(value) {
388
+ if (!(target._flags & 48) && !!(value & 48)) {
389
+ if (triggered.length) triggered[triggered.length - 1].push(this);
390
+ else onTrigger(this);
391
+ }
392
+ target._flags = value;
393
+ }
394
+ });
395
+ }
328
396
  //#endregion
329
397
  //#region packages/reactivity/src/dep.ts
330
398
  var Dep = class {
@@ -363,17 +431,17 @@ function trackDep(dep, target = dep, key = "value") {
363
431
  function triggerDep(dep, target = dep, key = "value", newValue, oldValue) {
364
432
  const subs = dep.subs;
365
433
  if (subs !== void 0) {
366
- triggerEventInfos.push({
434
+ startTrigger();
435
+ propagate(subs);
436
+ shallowPropagate(subs);
437
+ endTrigger({
367
438
  target,
368
439
  type: "set",
369
440
  key,
370
441
  newValue,
371
442
  oldValue
372
443
  });
373
- propagate(subs);
374
- shallowPropagate(subs);
375
444
  if (!batchDepth) flush();
376
- triggerEventInfos.pop();
377
445
  }
378
446
  }
379
447
  const targetMap = /* @__PURE__ */ new WeakMap();
@@ -417,20 +485,12 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
417
485
  if (!depsMap) return;
418
486
  const run = (dep) => {
419
487
  if (dep !== void 0 && dep.subs !== void 0) {
420
- triggerEventInfos.push({
421
- target,
422
- type,
423
- key,
424
- newValue,
425
- oldValue,
426
- oldTarget
427
- });
428
488
  propagate(dep.subs);
429
489
  shallowPropagate(dep.subs);
430
- triggerEventInfos.pop();
431
490
  }
432
491
  };
433
492
  startBatch();
493
+ startTrigger();
434
494
  if (type === "clear") depsMap.forEach(run);
435
495
  else {
436
496
  const targetIsArray = isArray(target);
@@ -460,6 +520,14 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
460
520
  }
461
521
  }
462
522
  }
523
+ endTrigger({
524
+ target,
525
+ type,
526
+ key,
527
+ newValue,
528
+ oldValue,
529
+ oldTarget
530
+ });
463
531
  endBatch();
464
532
  }
465
533
  function getDepFromReactive(object, key) {
@@ -674,7 +742,7 @@ function noTracking(self, method, args = []) {
674
742
  //#endregion
675
743
  //#region packages/reactivity/src/baseHandlers.ts
676
744
  const isNonTrackableKeys = /*@__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
677
- const builtInSymbols = new Set(/*@__PURE__*/ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol));
745
+ const builtInSymbols = /*@__PURE__*/ new Set(/*@__PURE__*/ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol));
678
746
  function hasOwnProperty(key) {
679
747
  if (!isSymbol(key)) key = String(key);
680
748
  const obj = /* @__PURE__ */ toRaw(this);
@@ -1258,16 +1326,16 @@ var RefImpl = class {
1258
1326
  this._value = !useDirectValue && this._wrap ? this._wrap(newValue) : newValue;
1259
1327
  const subs = this.subs;
1260
1328
  if (subs !== void 0) {
1261
- triggerEventInfos.push({
1329
+ startTrigger();
1330
+ propagate(subs);
1331
+ endTrigger({
1262
1332
  target: this,
1263
1333
  type: "set",
1264
1334
  key: "value",
1265
1335
  newValue,
1266
1336
  oldValue
1267
1337
  });
1268
- propagate(subs);
1269
1338
  if (!batchDepth) flush();
1270
- triggerEventInfos.pop();
1271
1339
  }
1272
1340
  }
1273
1341
  }
@@ -1304,8 +1372,10 @@ var RefImpl = class {
1304
1372
  function triggerRef(ref) {
1305
1373
  const dep = ref.dep;
1306
1374
  if (dep !== void 0 && dep.subs !== void 0) {
1375
+ startTrigger();
1307
1376
  propagate(dep.subs);
1308
1377
  shallowPropagate(dep.subs);
1378
+ endTrigger();
1309
1379
  if (!batchDepth) flush();
1310
1380
  }
1311
1381
  }
@@ -1504,6 +1574,10 @@ var ReactiveEffect = class {
1504
1574
  get active() {
1505
1575
  return !(this.flags & 1024);
1506
1576
  }
1577
+ /** @internal */
1578
+ get running() {
1579
+ return !!(this.flags & 4);
1580
+ }
1507
1581
  pause() {
1508
1582
  this.flags |= 256;
1509
1583
  }
@@ -1517,11 +1591,9 @@ var ReactiveEffect = class {
1517
1591
  if (!this.active) return this.fn();
1518
1592
  cleanup(this);
1519
1593
  const prevSub = startTracking(this);
1520
- incRunDepth();
1521
1594
  try {
1522
1595
  return this.fn();
1523
1596
  } finally {
1524
- decRunDepth();
1525
1597
  endTracking(this, prevSub);
1526
1598
  const flags = this.flags;
1527
1599
  if ((flags & 136) === 136) {
@@ -1544,9 +1616,9 @@ var ReactiveEffect = class {
1544
1616
  if (flags & 16) return true;
1545
1617
  if (flags & 32) {
1546
1618
  if (checkDirty(this.deps, this)) {
1547
- this.flags = flags | 16;
1619
+ if (this.active) this.flags |= 16;
1548
1620
  return true;
1549
- } else this.flags = flags & -33;
1621
+ } else this.flags &= -33;
1550
1622
  }
1551
1623
  return false;
1552
1624
  }
@@ -1558,20 +1630,17 @@ function effect(fn, options) {
1558
1630
  if (options) {
1559
1631
  const { onStop, scheduler } = options;
1560
1632
  if (onStop) {
1561
- options.onStop = void 0;
1562
1633
  const stop = e.stop.bind(e);
1563
1634
  e.stop = () => {
1564
1635
  stop();
1565
1636
  onStop();
1566
1637
  };
1567
1638
  }
1568
- if (scheduler) {
1569
- options.scheduler = void 0;
1570
- e.notify = () => {
1571
- if (!(e.flags & 256)) scheduler();
1572
- };
1573
- }
1574
- extend(e, options);
1639
+ if (scheduler) e.notify = () => {
1640
+ if (!(e.flags & 1280)) scheduler();
1641
+ };
1642
+ e.onTrack = options.onTrack;
1643
+ e.onTrigger = options.onTrigger;
1575
1644
  }
1576
1645
  try {
1577
1646
  e.run();
@@ -1684,8 +1753,10 @@ var EffectScope = class {
1684
1753
  const flags = this.flags;
1685
1754
  if (flags & 256) {
1686
1755
  this.flags = flags & -257;
1687
- for (let link = this.deps; link !== void 0; link = link.nextDep) {
1688
- const dep = link.dep;
1756
+ const deps = [];
1757
+ for (let link = this.deps; link !== void 0; link = link.nextDep) deps.push(link.dep);
1758
+ for (let i = 0; i < deps.length; i++) {
1759
+ const dep = deps[i];
1689
1760
  if ("resume" in dep) dep.resume();
1690
1761
  }
1691
1762
  }
@@ -1714,8 +1785,10 @@ var EffectScope = class {
1714
1785
  while (dep !== void 0) {
1715
1786
  const node = dep.dep;
1716
1787
  if ("stop" in node) {
1717
- dep = dep.nextDep;
1788
+ const prev = dep.prevDep;
1718
1789
  node.stop();
1790
+ const next = prev !== void 0 ? prev.nextDep : this.deps;
1791
+ dep = next === dep ? dep.nextDep : next;
1719
1792
  } else dep = unlink(dep, this);
1720
1793
  }
1721
1794
  cleanup(this);
@@ -1756,11 +1829,14 @@ function setCurrentScope(scope) {
1756
1829
  * @see {@link https://vuejs.org/api/reactivity-advanced.html#onscopedispose}
1757
1830
  */
1758
1831
  function onScopeDispose(fn, failSilently = false) {
1759
- if (activeEffectScope !== void 0) activeEffectScope.cleanups[activeEffectScope.cleanupsLength++] = fn;
1760
- else if (!failSilently) warn("onScopeDispose() is called when there is no active effect scope to be associated with.");
1832
+ if (activeEffectScope !== void 0) {
1833
+ if (activeEffectScope.active) activeEffectScope.cleanups[activeEffectScope.cleanupsLength++] = fn;
1834
+ else fn();
1835
+ } else if (!failSilently) warn("onScopeDispose() is called when there is no active effect scope to be associated with.");
1761
1836
  }
1762
1837
  //#endregion
1763
1838
  //#region packages/reactivity/src/computed.ts
1839
+ const FAILED = 64;
1764
1840
  /**
1765
1841
  * @private exported by @vue/reactivity for Vue core use, but not exported from
1766
1842
  * the main vue package
@@ -1809,12 +1885,24 @@ var ComputedRefImpl = class {
1809
1885
  }
1810
1886
  get value() {
1811
1887
  const flags = this.flags;
1812
- if (flags & 16 || flags & 32 && checkDirty(this.deps, this)) {
1813
- if (this.update()) {
1814
- const subs = this.subs;
1815
- if (subs !== void 0) shallowPropagate(subs);
1816
- }
1817
- } else if (flags & 32) this.flags = flags & -33;
1888
+ try {
1889
+ if (flags & 16 || flags & 32 && checkDirty(this.deps, this)) {
1890
+ if (this.update()) {
1891
+ const subs = this.subs;
1892
+ if (subs !== void 0) shallowPropagate(subs);
1893
+ }
1894
+ } else if (flags & 32) this.flags = flags & -33;
1895
+ } catch (err) {
1896
+ if (activeSub !== void 0) {
1897
+ onTrack(activeSub, {
1898
+ target: this,
1899
+ type: "get",
1900
+ key: "value"
1901
+ });
1902
+ link(this, activeSub);
1903
+ } else if (activeEffectScope !== void 0) link(this, activeEffectScope);
1904
+ throw err;
1905
+ }
1818
1906
  if (activeSub !== void 0) {
1819
1907
  onTrack(activeSub, {
1820
1908
  target: this,
@@ -1822,7 +1910,18 @@ var ComputedRefImpl = class {
1822
1910
  key: "value"
1823
1911
  });
1824
1912
  link(this, activeSub);
1825
- } else if (activeEffectScope !== void 0) link(this, activeEffectScope);
1913
+ } else if (activeEffectScope !== void 0) {
1914
+ if (activeEffectScope.active) link(this, activeEffectScope);
1915
+ else if (this.subs === void 0) {
1916
+ let dep = this.deps;
1917
+ if (dep !== void 0) {
1918
+ do
1919
+ dep = unlink(dep, this);
1920
+ while (dep !== void 0);
1921
+ this.flags |= 16;
1922
+ }
1923
+ }
1924
+ }
1826
1925
  return this._value;
1827
1926
  }
1828
1927
  set value(newValue) {
@@ -1834,11 +1933,15 @@ var ComputedRefImpl = class {
1834
1933
  try {
1835
1934
  const oldValue = this._value;
1836
1935
  const newValue = this.fn(oldValue);
1837
- if (hasChanged(oldValue, newValue)) {
1936
+ if (hasChanged(oldValue, newValue) || this.flags & FAILED) {
1838
1937
  this._value = newValue;
1938
+ this.flags &= -65;
1839
1939
  return true;
1840
1940
  }
1841
1941
  return false;
1942
+ } catch (err) {
1943
+ this.flags |= FAILED;
1944
+ throw err;
1842
1945
  } finally {
1843
1946
  endTracking(this, prevSub);
1844
1947
  }
@@ -1859,6 +1962,7 @@ function computed(getterOrOptions, debugOptions, isSSR = false) {
1859
1962
  cRef.onTrack = debugOptions.onTrack;
1860
1963
  cRef.onTrigger = debugOptions.onTrigger;
1861
1964
  }
1965
+ if (isSSR && activeEffectScope !== void 0) link(cRef, activeEffectScope);
1862
1966
  return cRef;
1863
1967
  }
1864
1968
  //#endregion