@solidjs/signals 0.4.9 → 0.4.11

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
@@ -330,14 +330,13 @@ function cloneGraph(node) {
330
330
  }
331
331
  function replaceSourceObservers(node, transition2) {
332
332
  let source;
333
- let transitionSource;
334
333
  let swap;
335
334
  for (let i = 0; i < node._sources.length; i++) {
336
- transitionSource = transition2._sources.get(node._sources[i]);
337
- source = transitionSource || node._sources[i];
335
+ source = transition2._sources.get(node._sources[i]) || node._sources[i];
338
336
  if (source._observers && (swap = source._observers.indexOf(node)) !== -1) {
339
- source._observers[swap] = transitionSource ? node._cloned : source._observers[source._observers.length - 1];
340
- !transitionSource && source._observers.pop();
337
+ const remove = source._observers.indexOf(node._cloned) > -1;
338
+ source._observers[swap] = !remove ? node._cloned : source._observers[source._observers.length - 1];
339
+ remove && source._observers.pop();
341
340
  }
342
341
  }
343
342
  }
@@ -654,7 +653,7 @@ var Computation = class extends Owner {
654
653
  * Automatically re-executes the surrounding computation when the value changes
655
654
  */
656
655
  read() {
657
- if (ActiveTransition && (ActiveTransition._sources.has(this) || !this._cloned && this._stateFlags & UNINITIALIZED_BIT | ERROR_BIT)) {
656
+ if (ActiveTransition && (ActiveTransition._sources.has(this) || !this._cloned && this._stateFlags & (UNINITIALIZED_BIT | ERROR_BIT))) {
658
657
  const clone = ActiveTransition._sources.get(this) || cloneGraph(this);
659
658
  if (clone !== this)
660
659
  return clone.read();
@@ -675,7 +674,7 @@ var Computation = class extends Owner {
675
674
  * before continuing
676
675
  */
677
676
  wait() {
678
- if (ActiveTransition && (ActiveTransition._sources.has(this) || !this._cloned && this._stateFlags & UNINITIALIZED_BIT)) {
677
+ if (ActiveTransition && (ActiveTransition._sources.has(this) || !this._cloned && this._stateFlags & (UNINITIALIZED_BIT | ERROR_BIT))) {
679
678
  const clone = ActiveTransition._sources.get(this) || cloneGraph(this);
680
679
  if (clone !== this)
681
680
  return clone.wait();
@@ -2206,7 +2205,7 @@ var BoundaryComputation = class extends EagerComputation {
2206
2205
  }
2207
2206
  write(value, flags) {
2208
2207
  super.write(value, flags & ~this._propagationMask);
2209
- if (this._propagationMask & LOADING_BIT && !(this._stateFlags & UNINITIALIZED_BIT)) {
2208
+ if (this._propagationMask & LOADING_BIT && !(this._stateFlags & UNINITIALIZED_BIT || ActiveTransition)) {
2210
2209
  flags &= ~LOADING_BIT;
2211
2210
  }
2212
2211
  this._queue.notify(this, this._propagationMask, flags);
@@ -2326,7 +2325,7 @@ function createCollectionBoundary(type, fn, fallback) {
2326
2325
  const decision = new Computation(void 0, () => {
2327
2326
  if (!queue._disabled.read()) {
2328
2327
  const resolved = tree.read();
2329
- if (!queue._disabled.read())
2328
+ if (!untrack(() => queue._disabled.read()))
2330
2329
  return resolved;
2331
2330
  }
2332
2331
  return fallback(queue);
package/dist/node.cjs CHANGED
@@ -330,14 +330,13 @@ function cloneGraph(node) {
330
330
  }
331
331
  function replaceSourceObservers(node, transition2) {
332
332
  let source;
333
- let transitionSource;
334
333
  let swap;
335
334
  for (let i = 0; i < node.a.length; i++) {
336
- transitionSource = transition2.a.get(node.a[i]);
337
- source = transitionSource || node.a[i];
335
+ source = transition2.a.get(node.a[i]) || node.a[i];
338
336
  if (source.b && (swap = source.b.indexOf(node)) !== -1) {
339
- source.b[swap] = transitionSource ? node.e : source.b[source.b.length - 1];
340
- !transitionSource && source.b.pop();
337
+ const remove = source.b.indexOf(node.e) > -1;
338
+ source.b[swap] = !remove ? node.e : source.b[source.b.length - 1];
339
+ remove && source.b.pop();
341
340
  }
342
341
  }
343
342
  }
@@ -653,7 +652,7 @@ var Computation = class extends Owner {
653
652
  * Automatically re-executes the surrounding computation when the value changes
654
653
  */
655
654
  read() {
656
- if (ActiveTransition && (ActiveTransition.a.has(this) || !this.e && this.h & UNINITIALIZED_BIT | ERROR_BIT)) {
655
+ if (ActiveTransition && (ActiveTransition.a.has(this) || !this.e && this.h & (UNINITIALIZED_BIT | ERROR_BIT))) {
657
656
  const clone = ActiveTransition.a.get(this) || cloneGraph(this);
658
657
  if (clone !== this)
659
658
  return clone.read();
@@ -674,7 +673,7 @@ var Computation = class extends Owner {
674
673
  * before continuing
675
674
  */
676
675
  wait() {
677
- if (ActiveTransition && (ActiveTransition.a.has(this) || !this.e && this.h & UNINITIALIZED_BIT)) {
676
+ if (ActiveTransition && (ActiveTransition.a.has(this) || !this.e && this.h & (UNINITIALIZED_BIT | ERROR_BIT))) {
678
677
  const clone = ActiveTransition.a.get(this) || cloneGraph(this);
679
678
  if (clone !== this)
680
679
  return clone.wait();
@@ -2210,7 +2209,7 @@ var BoundaryComputation = class extends EagerComputation {
2210
2209
  }
2211
2210
  write(value, flags) {
2212
2211
  super.write(value, flags & ~this.U);
2213
- if (this.U & LOADING_BIT && !(this.h & UNINITIALIZED_BIT)) {
2212
+ if (this.U & LOADING_BIT && !(this.h & UNINITIALIZED_BIT || ActiveTransition)) {
2214
2213
  flags &= ~LOADING_BIT;
2215
2214
  }
2216
2215
  this.m.notify(this, this.U, flags);
@@ -2330,7 +2329,7 @@ function createCollectionBoundary(type, fn, fallback) {
2330
2329
  const decision = new Computation(void 0, () => {
2331
2330
  if (!queue.u.read()) {
2332
2331
  const resolved = tree.read();
2333
- if (!queue.u.read())
2332
+ if (!untrack(() => queue.u.read()))
2334
2333
  return resolved;
2335
2334
  }
2336
2335
  return fallback(queue);
package/dist/prod.js CHANGED
@@ -327,14 +327,13 @@ function cloneGraph(node) {
327
327
  }
328
328
  function replaceSourceObservers(node, transition2) {
329
329
  let source;
330
- let transitionSource;
331
330
  let swap;
332
331
  for (let i = 0; i < node.a.length; i++) {
333
- transitionSource = transition2.a.get(node.a[i]);
334
- source = transitionSource || node.a[i];
332
+ source = transition2.a.get(node.a[i]) || node.a[i];
335
333
  if (source.b && (swap = source.b.indexOf(node)) !== -1) {
336
- source.b[swap] = transitionSource ? node.e : source.b[source.b.length - 1];
337
- !transitionSource && source.b.pop();
334
+ const remove = source.b.indexOf(node.e) > -1;
335
+ source.b[swap] = !remove ? node.e : source.b[source.b.length - 1];
336
+ remove && source.b.pop();
338
337
  }
339
338
  }
340
339
  }
@@ -650,7 +649,7 @@ var Computation = class extends Owner {
650
649
  * Automatically re-executes the surrounding computation when the value changes
651
650
  */
652
651
  read() {
653
- if (ActiveTransition && (ActiveTransition.a.has(this) || !this.e && this.h & UNINITIALIZED_BIT | ERROR_BIT)) {
652
+ if (ActiveTransition && (ActiveTransition.a.has(this) || !this.e && this.h & (UNINITIALIZED_BIT | ERROR_BIT))) {
654
653
  const clone = ActiveTransition.a.get(this) || cloneGraph(this);
655
654
  if (clone !== this)
656
655
  return clone.read();
@@ -671,7 +670,7 @@ var Computation = class extends Owner {
671
670
  * before continuing
672
671
  */
673
672
  wait() {
674
- if (ActiveTransition && (ActiveTransition.a.has(this) || !this.e && this.h & UNINITIALIZED_BIT)) {
673
+ if (ActiveTransition && (ActiveTransition.a.has(this) || !this.e && this.h & (UNINITIALIZED_BIT | ERROR_BIT))) {
675
674
  const clone = ActiveTransition.a.get(this) || cloneGraph(this);
676
675
  if (clone !== this)
677
676
  return clone.wait();
@@ -2194,7 +2193,7 @@ var BoundaryComputation = class extends EagerComputation {
2194
2193
  }
2195
2194
  write(value, flags) {
2196
2195
  super.write(value, flags & ~this.U);
2197
- if (this.U & LOADING_BIT && !(this.h & UNINITIALIZED_BIT)) {
2196
+ if (this.U & LOADING_BIT && !(this.h & UNINITIALIZED_BIT || ActiveTransition)) {
2198
2197
  flags &= ~LOADING_BIT;
2199
2198
  }
2200
2199
  this.m.notify(this, this.U, flags);
@@ -2314,7 +2313,7 @@ function createCollectionBoundary(type, fn, fallback) {
2314
2313
  const decision = new Computation(void 0, () => {
2315
2314
  if (!queue.u.read()) {
2316
2315
  const resolved = tree.read();
2317
- if (!queue.u.read())
2316
+ if (!untrack(() => queue.u.read()))
2318
2317
  return resolved;
2319
2318
  }
2320
2319
  return fallback(queue);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidjs/signals",
3
- "version": "0.4.9",
3
+ "version": "0.4.11",
4
4
  "description": "",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",