@solidjs/signals 2.0.0-beta.16 → 2.0.0-beta.17

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.
package/dist/node.cjs CHANGED
@@ -13,6 +13,9 @@ class StatusError extends Error {
13
13
  this.source = e;
14
14
  }
15
15
  }
16
+ function unwrapStatusError(e) {
17
+ return e instanceof StatusError ? e.cause : e;
18
+ }
16
19
  class NoOwnerError extends Error {
17
20
  constructor() {
18
21
  super("");
@@ -134,8 +137,8 @@ function assignOrMergeLane(e, t) {
134
137
  }
135
138
  e.i = t;
136
139
  }
137
- const I = new Set();
138
- const T = { _: new Array(2e3).fill(undefined), O: false, P: 0, C: 0 };
140
+ const T = new Set();
141
+ const I = { _: new Array(2e3).fill(undefined), O: false, P: 0, C: 0 };
139
142
  const L = { _: new Array(2e3).fill(undefined), O: false, P: 0, C: 0 };
140
143
  let H = 0;
141
144
  let M = null;
@@ -151,7 +154,7 @@ function registerTransientStoreNode(e) {
151
154
  }
152
155
  function canUseSimpleSyncFlush(e) {
153
156
  return (
154
- I.size === 0 &&
157
+ T.size === 0 &&
155
158
  R.size === 0 &&
156
159
  e.N.length === 0 &&
157
160
  e.k.length === 0 &&
@@ -187,8 +190,8 @@ function runLaneEffects(e) {
187
190
  }
188
191
  }
189
192
  function queueStashedOptimisticEffects(e) {
190
- for (let t = e.A; t !== null; t = t.I) {
191
- const e = t.T;
193
+ for (let t = e.A; t !== null; t = t.T) {
194
+ const e = t.I;
192
195
  if (!e.L) continue;
193
196
  if (e.L === P) {
194
197
  if (!e.H) {
@@ -197,7 +200,7 @@ function queueStashedOptimisticEffects(e) {
197
200
  }
198
201
  continue;
199
202
  }
200
- const n = e.q & o ? L : T;
203
+ const n = e.q & o ? L : I;
201
204
  if (n.P > e.V) n.P = e.V;
202
205
  insertIntoHeap(e, n);
203
206
  }
@@ -355,7 +358,7 @@ class GlobalQueue extends Queue {
355
358
  this.X = true;
356
359
  try {
357
360
  if (false);
358
- runHeap(T, GlobalQueue.re);
361
+ runHeap(I, GlobalQueue.re);
359
362
  if (M) {
360
363
  const e = transitionComplete(M);
361
364
  if (!e) {
@@ -369,7 +372,7 @@ class GlobalQueue extends Queue {
369
372
  runLaneEffects(v);
370
373
  this.stashQueues(e.ue);
371
374
  H++;
372
- K = T.C >= T.P;
375
+ K = I.C >= I.P;
373
376
  reassignPendingTransition(e.ne);
374
377
  M = null;
375
378
  if (!e.D.length && !e.G.size && e.k.length) {
@@ -390,7 +393,7 @@ class GlobalQueue extends Queue {
390
393
  }
391
394
  this.ne !== M.ne && this.ne.push(...M.ne);
392
395
  this.restoreQueues(M.ue);
393
- I.delete(M);
396
+ T.delete(M);
394
397
  const t = M;
395
398
  M = null;
396
399
  reassignPendingTransition(this.ne);
@@ -398,23 +401,23 @@ class GlobalQueue extends Queue {
398
401
  } else {
399
402
  if (canUseSimpleSyncFlush(this)) {
400
403
  commitPendingNodes();
401
- if (T.C >= T.P) {
402
- runHeap(T, GlobalQueue.re);
404
+ if (I.C >= I.P) {
405
+ runHeap(I, GlobalQueue.re);
403
406
  commitPendingNodes();
404
407
  }
405
408
  } else {
406
- if (I.size) runHeap(L, GlobalQueue.re);
409
+ if (T.size) runHeap(L, GlobalQueue.re);
407
410
  finalizePureQueue();
408
411
  }
409
412
  }
410
413
  H++;
411
- K = T.C >= T.P;
414
+ K = I.C >= I.P;
412
415
  R.size && runLaneEffects(O);
413
416
  this.run(O);
414
417
  R.size && runLaneEffects(v);
415
418
  this.run(v);
416
419
  if (false);
417
- if (false && !K && !M && I.size === 0 && R.size === 0);
420
+ if (false && !K && !M && T.size === 0 && R.size === 0);
418
421
  if (false);
419
422
  } finally {
420
423
  this.X = false;
@@ -456,10 +459,10 @@ class GlobalQueue extends Queue {
456
459
  } else if (e) {
457
460
  const t = M;
458
461
  mergeTransitionState(e, t);
459
- I.delete(t);
462
+ T.delete(t);
460
463
  M = e;
461
464
  }
462
- I.add(M);
465
+ T.add(M);
463
466
  M.ae = H;
464
467
  if (this.te !== null) {
465
468
  this.te.h = M;
@@ -509,19 +512,19 @@ function queuePendingNode(e) {
509
512
  function insertSubs(e, t = false) {
510
513
  const n = e.i || ee;
511
514
  const r = e.de !== undefined;
512
- for (let i = e.A; i !== null; i = i.I) {
513
- if (r && i.T.le & y) {
514
- i.T.q |= l;
515
+ for (let i = e.A; i !== null; i = i.T) {
516
+ if (r && i.I.le & y) {
517
+ i.I.q |= l;
515
518
  continue;
516
519
  }
517
520
  if (t && n) {
518
- i.T.q |= f;
519
- assignOrMergeLane(i.T, n);
521
+ i.I.q |= f;
522
+ assignOrMergeLane(i.I, n);
520
523
  } else if (t) {
521
- i.T.q |= f;
522
- i.T.i = undefined;
524
+ i.I.q |= f;
525
+ i.I.i = undefined;
523
526
  }
524
- const e = i.T;
527
+ const e = i.I;
525
528
  if (e.L === P) {
526
529
  if (!e.H) {
527
530
  e.H = true;
@@ -529,9 +532,9 @@ function insertSubs(e, t = false) {
529
532
  }
530
533
  continue;
531
534
  }
532
- const s = i.T.q & o ? L : T;
533
- if (s.P > i.T.V) s.P = i.T.V;
534
- insertIntoHeap(i.T, s);
535
+ const s = i.I.q & o ? L : I;
536
+ if (s.P > i.I.V) s.P = i.I.V;
537
+ insertIntoHeap(i.I, s);
535
538
  }
536
539
  }
537
540
  function commitPendingNode(e) {
@@ -569,8 +572,8 @@ function finalizePureQueue(e = null, t = false) {
569
572
  const n = !t;
570
573
  if (n) commitPendingNodes();
571
574
  if (!t && B.N.length) checkBoundaryChildren(B);
572
- const r = T.C >= T.P;
573
- if (r) runHeap(T, GlobalQueue.re);
575
+ const r = I.C >= I.P;
576
+ if (r) runHeap(I, GlobalQueue.re);
574
577
  if (n) {
575
578
  if (r) commitPendingNodes();
576
579
  resolveOptimisticNodes(e ? e.k : B.k);
@@ -584,7 +587,7 @@ function finalizePureQueue(e = null, t = false) {
584
587
  }
585
588
  continue;
586
589
  }
587
- const e = t.q & o ? L : T;
590
+ const e = t.q & o ? L : I;
588
591
  if (e.P > t.V) e.P = t.V;
589
592
  insertIntoHeap(t, e);
590
593
  }
@@ -759,13 +762,13 @@ function markNode(e, r = n) {
759
762
  const i = e.q;
760
763
  if ((i & (t | n)) >= r) return;
761
764
  e.q = (i & -4) | r;
762
- for (let n = e.A; n !== null; n = n.I) {
763
- markNode(n.T, t);
765
+ for (let n = e.A; n !== null; n = n.T) {
766
+ markNode(n.I, t);
764
767
  }
765
768
  if (e.Ce !== null) {
766
769
  for (let n = e.Ce; n !== null; n = n.xe) {
767
- for (let e = n.A; e !== null; e = e.I) {
768
- markNode(e.T, t);
770
+ for (let e = n.A; e !== null; e = e.T) {
771
+ markNode(e.I, t);
769
772
  }
770
773
  }
771
774
  }
@@ -792,8 +795,8 @@ function adjustHeight(e, t) {
792
795
  }
793
796
  if (e.V !== n) {
794
797
  e.V = n;
795
- for (let t = e.A; t !== null; t = t.I) {
796
- insertIntoHeapHeight(t.T, t.T.q & o ? L : T);
798
+ for (let t = e.A; t !== null; t = t.T) {
799
+ insertIntoHeapHeight(t.I, t.I.q & o ? L : I);
797
800
  }
798
801
  }
799
802
  }
@@ -804,7 +807,7 @@ function markDisposal(e) {
804
807
  const e = t.q;
805
808
  t.q = e | o;
806
809
  if (e & (i | s)) {
807
- deleteFromHeap(t, e & o ? L : T);
810
+ deleteFromHeap(t, e & o ? L : I);
808
811
  if (e & i) insertIntoHeap(t, L);
809
812
  else insertIntoHeapHeight(t, L);
810
813
  }
@@ -835,7 +838,7 @@ function disposeChildren(e, t = false, n) {
835
838
  const e = i.Ne;
836
839
  if (i.ge) {
837
840
  const e = i;
838
- deleteFromHeap(e, e.q & o ? L : T);
841
+ deleteFromHeap(e, e.q & o ? L : I);
839
842
  let t = e.ge;
840
843
  do {
841
844
  t = unlinkSubs(t);
@@ -868,7 +871,7 @@ function disposeChildren(e, t = false, n) {
868
871
  }
869
872
  }
870
873
  function runDisposal(e, t) {
871
- let n = t ? e.he : e.Ie;
874
+ let n = t ? e.he : e.Te;
872
875
  if (!n) return;
873
876
  if (Array.isArray(n)) {
874
877
  for (let e = 0; e < n.length; e++) {
@@ -878,7 +881,7 @@ function runDisposal(e, t) {
878
881
  } else {
879
882
  n.call(n);
880
883
  }
881
- t ? (e.he = null) : (e.Ie = null);
884
+ t ? (e.he = null) : (e.Te = null);
882
885
  }
883
886
  function childId(e, t) {
884
887
  let n = e;
@@ -906,9 +909,9 @@ function getOwner() {
906
909
  }
907
910
  function cleanup(e) {
908
911
  if (!Z) return e;
909
- if (!Z.Ie) Z.Ie = e;
910
- else if (Array.isArray(Z.Ie)) Z.Ie.push(e);
911
- else Z.Ie = [Z.Ie, e];
912
+ if (!Z.Te) Z.Te = e;
913
+ else if (Array.isArray(Z.Te)) Z.Te.push(e);
914
+ else Z.Te = [Z.Te, e];
912
915
  return e;
913
916
  }
914
917
  function isDisposed(e) {
@@ -928,9 +931,9 @@ function createOwner(e) {
928
931
  Ee: null,
929
932
  Ne: null,
930
933
  je: null,
931
- Ie: null,
934
+ Te: null,
932
935
  M: t?.M ?? B,
933
- Te: t?.Te || k,
936
+ Ie: t?.Ie || k,
934
937
  Ae: 0,
935
938
  he: null,
936
939
  pe: null,
@@ -956,11 +959,11 @@ function createRoot(e, t) {
956
959
  function unlinkSubs(e) {
957
960
  const t = e.we;
958
961
  const n = e.me;
959
- const r = e.I;
962
+ const r = e.T;
960
963
  const i = e.Le;
961
964
  if (r !== null) r.Le = i;
962
965
  else t.He = i;
963
- if (i !== null) i.I = r;
966
+ if (i !== null) i.T = r;
964
967
  else {
965
968
  t.A = r;
966
969
  if (r === null) {
@@ -983,7 +986,7 @@ function trimStaleDeps(e) {
983
986
  }
984
987
  }
985
988
  function unobserved(e) {
986
- deleteFromHeap(e, e.q & o ? L : T);
989
+ deleteFromHeap(e, e.q & o ? L : I);
987
990
  let t = e.ge;
988
991
  while (t !== null) {
989
992
  t = unlinkSubs(t);
@@ -1010,14 +1013,14 @@ function link(e, t, n = false) {
1010
1013
  }
1011
1014
  }
1012
1015
  const u = e.He;
1013
- if (u !== null && u.T === t && (!o || u.Ke === t.qe)) {
1016
+ if (u !== null && u.I === t && (!o || u.Ke === t.qe)) {
1014
1017
  u.Me = n;
1015
1018
  return;
1016
1019
  }
1017
- const f = (t.ke = e.He = { we: e, T: t, me: s, Le: u, I: null, Ke: t.qe, Me: n });
1020
+ const f = (t.ke = e.He = { we: e, I: t, me: s, Le: u, T: null, Ke: t.qe, Me: n });
1018
1021
  if (i !== null) i.me = f;
1019
1022
  else t.ge = f;
1020
- if (u !== null) u.I = f;
1023
+ if (u !== null) u.T = f;
1021
1024
  else e.A = f;
1022
1025
  }
1023
1026
  function addPendingSource(e, t) {
@@ -1069,9 +1072,9 @@ function setPendingError(e, t, n) {
1069
1072
  }
1070
1073
  }
1071
1074
  function forEachDependent(e, t) {
1072
- for (let n = e.A; n !== null; n = n.I) t(n.T, n);
1075
+ for (let n = e.A; n !== null; n = n.T) t(n.I, n);
1073
1076
  for (let n = e.Ce; n !== null; n = n.xe) {
1074
- for (let e = n.A; e !== null; e = e.I) t(e.T, e);
1077
+ for (let e = n.A; e !== null; e = e.T) t(e.I, e);
1075
1078
  }
1076
1079
  }
1077
1080
  function enqueueForRerun(e) {
@@ -1082,7 +1085,7 @@ function enqueueForRerun(e) {
1082
1085
  t.M.enqueue(v, t.K);
1083
1086
  }
1084
1087
  } else {
1085
- const t = e.q & o ? L : T;
1088
+ const t = e.q & o ? L : I;
1086
1089
  if (t.P > e.V) t.P = e.V;
1087
1090
  insertIntoHeap(e, t);
1088
1091
  }
@@ -1213,6 +1216,7 @@ function handleAsync(e, t, r) {
1213
1216
  const n = t[Symbol.asyncIterator]();
1214
1217
  let r = false;
1215
1218
  let i = false;
1219
+ let s = true;
1216
1220
  cleanup(() => {
1217
1221
  if (i) return;
1218
1222
  i = true;
@@ -1222,41 +1226,59 @@ function handleAsync(e, t, r) {
1222
1226
  } catch {}
1223
1227
  });
1224
1228
  const iterate = () => {
1225
- let s,
1226
- u = false,
1227
- f = true;
1229
+ let u,
1230
+ f,
1231
+ l = false,
1232
+ c = false,
1233
+ a = true;
1228
1234
  n.next().then(
1229
1235
  n => {
1230
- if (f) {
1231
- s = n;
1232
- u = true;
1236
+ if (a) {
1237
+ u = n;
1238
+ l = true;
1233
1239
  if (n.done) i = true;
1234
1240
  } else if (e.We !== t) {
1235
1241
  return;
1236
- } else if (!n.done) asyncWrite(n.value, iterate);
1237
- else {
1242
+ } else if (!n.done) {
1243
+ r = true;
1244
+ asyncWrite(n.value, iterate);
1245
+ } else {
1238
1246
  i = true;
1239
- schedule();
1240
- flush();
1247
+ if (r) {
1248
+ schedule();
1249
+ flush();
1250
+ } else {
1251
+ asyncWrite(undefined);
1252
+ }
1241
1253
  }
1242
1254
  },
1243
1255
  n => {
1244
- if (!f && e.We === t) {
1256
+ if (a) {
1257
+ f = n;
1258
+ c = true;
1259
+ } else if (e.We === t) {
1245
1260
  i = true;
1246
1261
  handleError(n);
1247
1262
  }
1248
1263
  }
1249
1264
  );
1250
- f = false;
1251
- if (u && !s.done) {
1252
- o = s.value;
1265
+ a = false;
1266
+ if (c) {
1267
+ i = true;
1268
+ handleError(f);
1269
+ if (s) throw f;
1270
+ return true;
1271
+ }
1272
+ if (l && !u.done) {
1273
+ o = u.value;
1253
1274
  r = true;
1254
1275
  return iterate();
1255
1276
  }
1256
- return u && s.done;
1277
+ return l && u.done;
1257
1278
  };
1258
- const s = iterate();
1259
- if (!r && !s) {
1279
+ const u = iterate();
1280
+ s = false;
1281
+ if (!r && !u) {
1260
1282
  B.initTransition(resolveTransition(e));
1261
1283
  throw new NotReadyError(Z);
1262
1284
  }
@@ -1390,8 +1412,8 @@ function releaseSubtree(e) {
1390
1412
  if (e.q & l) {
1391
1413
  e.q &= ~l;
1392
1414
  e.q |= n;
1393
- if (T.P > e.V) T.P = e.V;
1394
- insertIntoHeap(e, T);
1415
+ if (I.P > e.V) I.P = e.V;
1416
+ insertIntoHeap(e, I);
1395
1417
  }
1396
1418
  }
1397
1419
  releaseSubtree(t);
@@ -1412,14 +1434,14 @@ function recompute(t, n = false) {
1412
1434
  const i = t.L;
1413
1435
  if (!n) {
1414
1436
  if (t.h && (!i || M) && M !== t.h) B.initTransition(t.h);
1415
- deleteFromHeap(t, t.q & o ? L : T);
1437
+ deleteFromHeap(t, t.q & o ? L : I);
1416
1438
  t.We = null;
1417
1439
  if (t.h || i === P) disposeChildren(t);
1418
- else if (t.Ee !== null || t.Ie !== null) {
1440
+ else if (t.Ee !== null || t.Te !== null) {
1419
1441
  markDisposal(t);
1420
- t.he = t.Ie;
1442
+ t.he = t.Te;
1421
1443
  t.pe = t.Ee;
1422
- t.Ie = null;
1444
+ t.Te = null;
1423
1445
  t.Ee = null;
1424
1446
  t.Ae = 0;
1425
1447
  } else;
@@ -1534,8 +1556,8 @@ function recompute(t, n = false) {
1534
1556
  if (t.j === C) queuePendingNode(t);
1535
1557
  t.j = d;
1536
1558
  } else if (t.V != p) {
1537
- for (let e = t.A; e !== null; e = e.I) {
1538
- insertIntoHeapHeight(e.T, e.T.q & o ? L : T);
1559
+ for (let e = t.A; e !== null; e = e.T) {
1560
+ insertIntoHeapHeight(e.I, e.I.q & o ? L : I);
1539
1561
  }
1540
1562
  }
1541
1563
  }
@@ -1575,9 +1597,9 @@ function computed(t, n) {
1575
1597
  (ne && ownerInSnapshotScope(Z) ? y : 0),
1576
1598
  Fe: n?.equals != null ? n.equals : isEqual,
1577
1599
  R: n?.unobserved,
1578
- Ie: null,
1600
+ Te: null,
1579
1601
  M: Z?.M ?? B,
1580
- Te: Z?.Te ?? k,
1602
+ Ie: Z?.Ie ?? k,
1581
1603
  Ae: 0,
1582
1604
  fe: t,
1583
1605
  Y: undefined,
@@ -1617,9 +1639,9 @@ function createEffectNode(e, t, n, r, i, s) {
1617
1639
  (ne && ownerInSnapshotScope(Z) ? y : 0),
1618
1640
  Fe: false,
1619
1641
  R: s?.unobserved,
1620
- Ie: null,
1642
+ Te: null,
1621
1643
  M: Z?.M ?? B,
1622
- Te: Z?.Te ?? k,
1644
+ Ie: Z?.Ie ?? k,
1623
1645
  Ae: 0,
1624
1646
  fe: e,
1625
1647
  Y: undefined,
@@ -1804,9 +1826,9 @@ function read(e) {
1804
1826
  link(e, t, J);
1805
1827
  if (i.fe) {
1806
1828
  const n = e.q & o;
1807
- if (i.V >= (n ? L.P : T.P)) {
1829
+ if (i.V >= (n ? L.P : I.P)) {
1808
1830
  markNode(t);
1809
- markHeap(n ? L : T);
1831
+ markHeap(n ? L : I);
1810
1832
  updateIfNecessary(i);
1811
1833
  }
1812
1834
  const r = i.V;
@@ -1903,7 +1925,7 @@ function setSignal(e, t) {
1903
1925
  return t;
1904
1926
  }
1905
1927
  function suppressComputedRecompute(e) {
1906
- deleteFromHeap(e, e.q & o ? L : T);
1928
+ deleteFromHeap(e, e.q & o ? L : I);
1907
1929
  if (!(e.q & a) && e.j === C) {
1908
1930
  queuePendingNode(e);
1909
1931
  schedule();
@@ -1991,7 +2013,7 @@ function snapCompanionsToState(e) {
1991
2013
  if (i && !(i.q & u)) {
1992
2014
  if ((i.m === undefined || i.m === C) && i.j === C && !Object.is(i.Y, e.Y) && !(i.q & (n | t))) {
1993
2015
  i.q |= n;
1994
- insertIntoHeap(i, i.q & o ? L : T);
2016
+ insertIntoHeap(i, i.q & o ? L : I);
1995
2017
  insertSubs(i);
1996
2018
  schedule();
1997
2019
  }
@@ -2070,7 +2092,7 @@ function refresh(e) {
2070
2092
  }
2071
2093
  if (typeof r.fe === "function" && !(r.q & (u | a))) {
2072
2094
  r.q = (r.q & ~t) | n;
2073
- insertIntoHeap(r, r.q & o ? L : T);
2095
+ insertIntoHeap(r, r.q & o ? L : I);
2074
2096
  schedule();
2075
2097
  }
2076
2098
  }
@@ -2081,7 +2103,7 @@ function getContext(e, t = getOwner()) {
2081
2103
  if (!t) {
2082
2104
  throw new NoOwnerError();
2083
2105
  }
2084
- const n = hasContext(e, t) ? t.Te[e.id] : e.defaultValue;
2106
+ const n = hasContext(e, t) ? t.Ie[e.id] : e.defaultValue;
2085
2107
  if (isUndefined(n)) {
2086
2108
  throw new ContextNotFoundError();
2087
2109
  }
@@ -2091,10 +2113,10 @@ function setContext(e, t, n = getOwner()) {
2091
2113
  if (!n) {
2092
2114
  throw new NoOwnerError();
2093
2115
  }
2094
- n.Te = { ...n.Te, [e.id]: isUndefined(t) ? e.defaultValue : t };
2116
+ n.Ie = { ...n.Ie, [e.id]: isUndefined(t) ? e.defaultValue : t };
2095
2117
  }
2096
2118
  function hasContext(e, t) {
2097
- return !isUndefined(t?.Te[e.id]);
2119
+ return !isUndefined(t?.Ie[e.id]);
2098
2120
  }
2099
2121
  function isUndefined(e) {
2100
2122
  return typeof e === "undefined";
@@ -2129,7 +2151,7 @@ function notifyEffectStatus(e, t) {
2129
2151
  function runEffect(e) {
2130
2152
  if (!e.H || e.q & u) return;
2131
2153
  if (e.U & b && e.L === v) {
2132
- const t = e.ce instanceof StatusError ? (e.ce.cause ?? e.ce) : e.ce;
2154
+ const t = unwrapStatusError(e.ce);
2133
2155
  e.ze = e.Y;
2134
2156
  e.H = false;
2135
2157
  try {
@@ -2218,22 +2240,22 @@ function action(e) {
2218
2240
  B.initTransition();
2219
2241
  let s = M;
2220
2242
  s.D.push(i);
2221
- const done = (e, t) => {
2243
+ const done = (e, t, o = false) => {
2222
2244
  s = currentTransition(s);
2223
- const o = s.D.indexOf(i);
2224
- if (o >= 0) s.D.splice(o, 1);
2245
+ const u = s.D.indexOf(i);
2246
+ if (u >= 0) s.D.splice(u, 1);
2225
2247
  setActiveTransition(s);
2226
2248
  schedule();
2227
- t ? r(t) : n(e);
2249
+ o ? r(t) : n(e);
2228
2250
  };
2229
2251
  const step = (e, t) => {
2230
2252
  let n;
2231
2253
  try {
2232
2254
  n = t ? i.throw(e) : i.next(e);
2233
2255
  } catch (e) {
2234
- return done(undefined, e);
2256
+ return done(undefined, e, true);
2235
2257
  }
2236
- if (isThenable(n)) return void n.then(run, e => done(undefined, e));
2258
+ if (isThenable(n)) return void n.then(run, e => done(undefined, e, true));
2237
2259
  run(n);
2238
2260
  };
2239
2261
  const run = e => {
@@ -2281,11 +2303,17 @@ function createReaction(e, t) {
2281
2303
  let n = undefined;
2282
2304
  cleanup(() => n?.());
2283
2305
  const r = getOwner();
2284
- return i => {
2306
+ let i;
2307
+ return s => {
2308
+ if (i) {
2309
+ dispose(i);
2310
+ i = undefined;
2311
+ }
2285
2312
  runWithOwner(r, () => {
2286
2313
  effect(
2287
- () => (i(), getOwner()),
2314
+ () => (s(), (i = getOwner())),
2288
2315
  t => {
2316
+ i = undefined;
2289
2317
  n?.();
2290
2318
  const r = (e.effect || e)?.();
2291
2319
  if (false && r !== undefined && typeof r !== "function");
@@ -2917,7 +2945,9 @@ function getNode(e, t, n, r, i = isEqual, s, o) {
2917
2945
  return (e[t] = u);
2918
2946
  }
2919
2947
  function trackSelf(e, t = se) {
2920
- getObserver() && read(getNode(getNodes(e, de), t, undefined, e[ge], false, e[me]));
2948
+ if (!getObserver()) return;
2949
+ read(getNode(getNodes(e, de), t, undefined, e[ge], false, e[me]));
2950
+ if (t === se && !e[ce] && !e[ae] && e[le][oe]) e[le][se];
2921
2951
  }
2922
2952
  function notifySelf(e) {
2923
2953
  const t = e[de]?.[se];
@@ -3118,17 +3148,19 @@ const Ce = {
3118
3148
  const f = u ? u[t] : i;
3119
3149
  const l = u ? u[t] !== fe : t in e[le];
3120
3150
  const c = unwrapStoreValue(n);
3121
- const a = Array.isArray(o) && t !== "length" && typeof t !== "symbol";
3122
- const d = a ? parseInt(t) + 1 : 0;
3123
- const p = a && (getOverlayLayer(e, "length") ?? o).length;
3124
- const h = a && d > p ? d : undefined;
3125
- if (f === c && h === undefined) return true;
3151
+ const a = typeof t === "string" ? Number(t) : -1;
3152
+ const d =
3153
+ Array.isArray(o) && Number.isInteger(a) && a >= 0 && a < 4294967295 && String(a) === t;
3154
+ const p = d ? a + 1 : 0;
3155
+ const h = d && (getOverlayLayer(e, "length") ?? o).length;
3156
+ const y = d && p > h ? p : undefined;
3157
+ if (f === c && y === undefined) return true;
3126
3158
  armOptimisticStoreWrite(e, r);
3127
- if (c !== undefined && c === i && h === undefined) delete e[s]?.[t];
3159
+ if (c !== undefined && c === i && y === undefined) delete e[s]?.[t];
3128
3160
  else {
3129
3161
  const n = e[s] || (e[s] = Object.create(null));
3130
3162
  n[t] = c;
3131
- if (h !== undefined) n.length = h;
3163
+ if (y !== undefined) n.length = y;
3132
3164
  }
3133
3165
  notifyStoreProperty(e, t, "set", c, f, l);
3134
3166
  if (
@@ -3147,13 +3179,13 @@ const Ce = {
3147
3179
  notifyStoreProperty(e, n, "delete", undefined, r, true);
3148
3180
  }
3149
3181
  }
3150
- if (Array.isArray(o) && t !== "length" && h !== undefined) {
3182
+ if (Array.isArray(o) && t !== "length" && y !== undefined) {
3151
3183
  const t = getNodes(e, de);
3152
3184
  if (t.length) {
3153
- setSignal(t.length, h);
3185
+ setSignal(t.length, y);
3154
3186
  } else if (!Q && !e[me]) {
3155
- const n = upsertStoreNode(e, t, "length", p, e[E]);
3156
- setSignal(n, h);
3187
+ const n = upsertStoreNode(e, t, "length", h, e[E]);
3188
+ setSignal(n, y);
3157
3189
  }
3158
3190
  }
3159
3191
  if (false);
@@ -4074,9 +4106,6 @@ class CollectionQueue extends Queue {
4074
4106
  this.yt.clear();
4075
4107
  }
4076
4108
  }
4077
- if (this.Wt & w && n & b) {
4078
- return super.notify(e, b, n, r);
4079
- }
4080
4109
  if (this.Wt & w && this.Ot) return super.notify(e, t, n, r);
4081
4110
  if (n & this.Wt) {
4082
4111
  this.St = true;
@@ -4086,7 +4115,7 @@ class CollectionQueue extends Queue {
4086
4115
  this.yt.add(t);
4087
4116
  if (e) setSignal(this.gt, true);
4088
4117
  if (this.Wt & b) {
4089
- setSignal(this.ce, t.ce?.cause ?? t.ce);
4118
+ setSignal(this.ce, unwrapStatusError(t.ce));
4090
4119
  }
4091
4120
  }
4092
4121
  }
@@ -4235,13 +4264,13 @@ function flattenArray(e, t = [], n) {
4235
4264
  if (r) throw r;
4236
4265
  return i;
4237
4266
  }
4238
- const Ie = undefined;
4267
+ const Te = undefined;
4239
4268
  exports.$PROXY = ue;
4240
4269
  exports.$REFRESH = W;
4241
4270
  exports.$TARGET = oe;
4242
4271
  exports.$TRACK = se;
4243
4272
  exports.ContextNotFoundError = ContextNotFoundError;
4244
- exports.DEV = Ie;
4273
+ exports.DEV = Te;
4245
4274
  exports.NoOwnerError = NoOwnerError;
4246
4275
  exports.NotReadyError = NotReadyError;
4247
4276
  exports.SUPPORTS_PROXY = N;