@solidjs/signals 0.9.7 → 0.9.8

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/dev.js CHANGED
@@ -350,7 +350,6 @@ function insertSubs(node, optimistic = false) {
350
350
  function finalizePureQueue(completingTransition = null, incomplete = false) {
351
351
  let resolvePending = !incomplete;
352
352
  if (dirtyQueue._max >= dirtyQueue._min) {
353
- resolvePending = true;
354
353
  runHeap(dirtyQueue, GlobalQueue._update);
355
354
  }
356
355
  if (resolvePending) {
@@ -562,6 +561,7 @@ function recompute(el, create = false) {
562
561
  setOptimisticReadActive(prevOptimisticRead);
563
562
  (!create || el._statusFlags & STATUS_PENDING) &&
564
563
  !el._transition &&
564
+ !(activeTransition && el._optimistic) &&
565
565
  globalQueue._pendingNodes.push(el);
566
566
  el._transition &&
567
567
  isEffect &&
@@ -1042,12 +1042,14 @@ function setSignal(el, v) {
1042
1042
  const valueChanged = !el._equals || !el._equals(currentValue, v);
1043
1043
  if (!valueChanged) return v;
1044
1044
  if (isOptimistic) {
1045
- const isFirstWrite = el._pendingValue === NOT_PENDING;
1046
- if (el._transition && !isFirstWrite) {
1045
+ const alreadyTracked = globalQueue._optimisticNodes.includes(el);
1046
+ if (el._transition && alreadyTracked) {
1047
1047
  globalQueue.initTransition(el._transition);
1048
1048
  }
1049
- if (isFirstWrite) {
1049
+ if (el._pendingValue === NOT_PENDING) {
1050
1050
  el._pendingValue = el._value;
1051
+ }
1052
+ if (!alreadyTracked) {
1051
1053
  globalQueue._optimisticNodes.push(el);
1052
1054
  }
1053
1055
  el._value = v;
package/dist/node.cjs CHANGED
@@ -343,7 +343,6 @@ function insertSubs(e, t = false) {
343
343
  function finalizePureQueue(e = null, t = false) {
344
344
  let n = !t;
345
345
  if (_.S >= _.W) {
346
- n = true;
347
346
  runHeap(_, GlobalQueue.K);
348
347
  }
349
348
  if (n) {
@@ -539,7 +538,7 @@ function recompute(t, n = false) {
539
538
  }
540
539
  }
541
540
  setOptimisticReadActive(y);
542
- (!n || t.re & c) && !t.X && A.D.push(t);
541
+ (!n || t.re & c) && !t.X && !(v && t.le) && A.D.push(t);
543
542
  t.X && i && v !== t.X && runInTransition(t.X, () => recompute(t));
544
543
  }
545
544
  function handleAsync(e, t, n) {
@@ -989,12 +988,14 @@ function setSignal(e, t) {
989
988
  const i = !e.ae || !e.ae(r, t);
990
989
  if (!i) return t;
991
990
  if (n) {
992
- const n = e.te === g;
993
- if (e.X && !n) {
991
+ const n = A.B.includes(e);
992
+ if (e.X && n) {
994
993
  A.initTransition(e.X);
995
994
  }
996
- if (n) {
995
+ if (e.te === g) {
997
996
  e.te = e.ne;
997
+ }
998
+ if (!n) {
998
999
  A.B.push(e);
999
1000
  }
1000
1001
  e.ne = t;
package/dist/prod.js CHANGED
@@ -342,7 +342,6 @@ function insertSubs(e, t = false) {
342
342
  function finalizePureQueue(e = null, t = false) {
343
343
  let n = !t;
344
344
  if (dirtyQueue.O >= dirtyQueue.N) {
345
- n = true;
346
345
  runHeap(dirtyQueue, GlobalQueue.j);
347
346
  }
348
347
  if (n) {
@@ -539,7 +538,7 @@ function recompute(e, t = false) {
539
538
  }
540
539
  }
541
540
  setOptimisticReadActive(c);
542
- (!t || e.ie & STATUS_PENDING) && !e.X && globalQueue.L.push(e);
541
+ (!t || e.ie & STATUS_PENDING) && !e.X && !(activeTransition && e.le) && globalQueue.L.push(e);
543
542
  e.X && n && activeTransition !== e.X && runInTransition(e.X, () => recompute(e));
544
543
  }
545
544
  function handleAsync(e, t, n) {
@@ -1000,12 +999,14 @@ function setSignal(e, t) {
1000
999
  const r = !e.fe || !e.fe(i, t);
1001
1000
  if (!r) return t;
1002
1001
  if (n) {
1003
- const n = e.te === NOT_PENDING;
1004
- if (e.X && !n) {
1002
+ const n = globalQueue.H.includes(e);
1003
+ if (e.X && n) {
1005
1004
  globalQueue.initTransition(e.X);
1006
1005
  }
1007
- if (n) {
1006
+ if (e.te === NOT_PENDING) {
1008
1007
  e.te = e.ne;
1008
+ }
1009
+ if (!n) {
1009
1010
  globalQueue.H.push(e);
1010
1011
  }
1011
1012
  e.ne = t;
@@ -2120,8 +2121,8 @@ function mapArray(e, t, n) {
2120
2121
  Ue: [],
2121
2122
  ke: i,
2122
2123
  We: i || n?.keyed === false ? [] : undefined,
2123
- xe: t.length > 1 ? [] : undefined,
2124
- Qe: n?.fallback
2124
+ Qe: t.length > 1 ? [] : undefined,
2125
+ xe: n?.fallback
2125
2126
  })
2126
2127
  );
2127
2128
  }
@@ -2136,17 +2137,17 @@ function updateKeyedMap() {
2136
2137
  r = this.We
2137
2138
  ? () => {
2138
2139
  this.We[i] = signal(e[i], pureOptions);
2139
- this.xe && (this.xe[i] = signal(i, pureOptions));
2140
+ this.Qe && (this.Qe[i] = signal(i, pureOptions));
2140
2141
  return this.Ve(
2141
2142
  read.bind(null, this.We[i]),
2142
- this.xe ? read.bind(null, this.xe[i]) : undefined
2143
+ this.Qe ? read.bind(null, this.Qe[i]) : undefined
2143
2144
  );
2144
2145
  }
2145
- : this.xe
2146
+ : this.Qe
2146
2147
  ? () => {
2147
2148
  const t = e[i];
2148
- this.xe[i] = signal(i, pureOptions);
2149
- return this.Ve(() => t, read.bind(null, this.xe[i]));
2149
+ this.Qe[i] = signal(i, pureOptions);
2150
+ return this.Ve(() => t, read.bind(null, this.Qe[i]));
2150
2151
  }
2151
2152
  : () => {
2152
2153
  const t = e[i];
@@ -2160,10 +2161,10 @@ function updateKeyedMap() {
2160
2161
  this.me = [];
2161
2162
  this.we = 0;
2162
2163
  this.We && (this.We = []);
2163
- this.xe && (this.xe = []);
2164
+ this.Qe && (this.Qe = []);
2164
2165
  }
2165
- if (this.Qe && !this.me[0]) {
2166
- this.me[0] = runWithOwner((this.Ue[0] = createOwner()), this.Qe);
2166
+ if (this.xe && !this.me[0]) {
2167
+ this.me[0] = runWithOwner((this.Ue[0] = createOwner()), this.xe);
2167
2168
  }
2168
2169
  } else if (this.we === 0) {
2169
2170
  if (this.Ue[0]) this.Ue[0].dispose();
@@ -2184,7 +2185,7 @@ function updateKeyedMap() {
2184
2185
  E = new Array(t),
2185
2186
  T = new Array(t),
2186
2187
  R = this.We ? new Array(t) : undefined,
2187
- d = this.xe ? new Array(t) : undefined;
2188
+ d = this.Qe ? new Array(t) : undefined;
2188
2189
  for (
2189
2190
  o = 0, s = Math.min(this.we, t);
2190
2191
  o < s && (this.ve[o] === e[o] || (this.We && compare(this.ke, this.ve[o], e[o])));
@@ -2202,7 +2203,7 @@ function updateKeyedMap() {
2202
2203
  E[u] = this.me[s];
2203
2204
  T[u] = this.Ue[s];
2204
2205
  R && (R[u] = this.We[s]);
2205
- d && (d[u] = this.xe[s]);
2206
+ d && (d[u] = this.Qe[s]);
2206
2207
  }
2207
2208
  a = new Map();
2208
2209
  f = new Array(u + 1);
@@ -2221,7 +2222,7 @@ function updateKeyedMap() {
2221
2222
  E[i] = this.me[n];
2222
2223
  T[i] = this.Ue[n];
2223
2224
  R && (R[i] = this.We[n]);
2224
- d && (d[i] = this.xe[n]);
2225
+ d && (d[i] = this.Qe[n]);
2225
2226
  i = f[i];
2226
2227
  a.set(c, i);
2227
2228
  } else this.Ue[n].dispose();
@@ -2235,8 +2236,8 @@ function updateKeyedMap() {
2235
2236
  setSignal(this.We[i], e[i]);
2236
2237
  }
2237
2238
  if (d) {
2238
- this.xe[i] = d[i];
2239
- setSignal(this.xe[i], i);
2239
+ this.Qe[i] = d[i];
2240
+ setSignal(this.Qe[i], i);
2240
2241
  }
2241
2242
  } else {
2242
2243
  this.me[i] = runWithOwner((this.Ue[i] = createOwner()), r);
@@ -2258,7 +2259,7 @@ function repeat(e, t, n) {
2258
2259
  Ue: [],
2259
2260
  me: [],
2260
2261
  $e: n?.from,
2261
- Qe: n?.fallback
2262
+ xe: n?.fallback
2262
2263
  });
2263
2264
  }
2264
2265
  function updateRepeat() {
@@ -2272,8 +2273,8 @@ function updateRepeat() {
2272
2273
  this.me = [];
2273
2274
  this.we = 0;
2274
2275
  }
2275
- if (this.Qe && !this.me[0]) {
2276
- this.me[0] = runWithOwner((this.Ue[0] = createOwner()), this.Qe);
2276
+ if (this.xe && !this.me[0]) {
2277
+ this.me[0] = runWithOwner((this.Ue[0] = createOwner()), this.xe);
2277
2278
  }
2278
2279
  return;
2279
2280
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidjs/signals",
3
- "version": "0.9.7",
3
+ "version": "0.9.8",
4
4
  "description": "",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",