@solidjs/signals 0.3.1 → 0.3.2

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
@@ -49,43 +49,39 @@ function schedule() {
49
49
  if (!globalQueue._running)
50
50
  queueMicrotask(flushSync);
51
51
  }
52
+ var pureQueue = [];
52
53
  var Queue = class {
53
54
  _parent = null;
54
55
  _running = false;
55
- _queues = [[], [], []];
56
+ _queues = [[], []];
56
57
  _children = [];
57
58
  created = clock;
58
59
  enqueue(type, node) {
59
- this._queues[0].push(node);
60
+ pureQueue.push(node);
60
61
  if (type)
61
- this._queues[type].push(node);
62
+ this._queues[type - 1].push(node);
62
63
  schedule();
63
64
  }
64
65
  run(type) {
65
- if (this._queues[type].length) {
66
- if (type === EFFECT_PURE) {
67
- runPureQueue(this._queues[type]);
68
- this._queues[type] = [];
69
- } else {
70
- const effects = this._queues[type];
71
- this._queues[type] = [];
72
- runEffectQueue(effects);
73
- }
66
+ if (type === EFFECT_PURE) {
67
+ pureQueue.length && runPureQueue(pureQueue);
68
+ pureQueue = [];
69
+ return;
70
+ } else if (this._queues[type - 1].length) {
71
+ const effects = this._queues[type - 1];
72
+ this._queues[type - 1] = [];
73
+ runEffectQueue(effects);
74
74
  }
75
- let rerun = false;
76
75
  for (let i = 0; i < this._children.length; i++) {
77
- rerun = this._children[i].run(type) || rerun;
76
+ this._children[i].run(type);
78
77
  }
79
- if (type === EFFECT_PURE)
80
- return rerun || !!this._queues[type].length;
81
78
  }
82
79
  flush() {
83
80
  if (this._running)
84
81
  return;
85
82
  this._running = true;
86
83
  try {
87
- while (this.run(EFFECT_PURE)) {
88
- }
84
+ this.run(EFFECT_PURE);
89
85
  incrementClock();
90
86
  scheduled = false;
91
87
  this.run(EFFECT_RENDER);
@@ -197,7 +193,7 @@ var Owner = class {
197
193
  constructor(id = null, skipAppend = false) {
198
194
  this.id = id;
199
195
  if (currentOwner) {
200
- if (!id && currentOwner.id)
196
+ if (id == null && currentOwner.id != null)
201
197
  this.id = currentOwner.getNextChildId();
202
198
  !skipAppend && currentOwner.append(this);
203
199
  }
@@ -257,7 +253,7 @@ var Owner = class {
257
253
  this._disposal = null;
258
254
  }
259
255
  getNextChildId() {
260
- if (this.id)
256
+ if (this.id != null)
261
257
  return formatId(this.id, this._childCount++);
262
258
  throw new Error("Cannot get child id from owner without an id");
263
259
  }
@@ -852,7 +848,7 @@ var EagerComputation = class extends Computation {
852
848
  _notify(state, skipQueue) {
853
849
  if (this._state >= state && !this._forceNotify)
854
850
  return;
855
- if (this._state === STATE_CLEAN && !skipQueue)
851
+ if (!skipQueue && (this._state === STATE_CLEAN || this._state === STATE_CHECK && this._forceNotify))
856
852
  this._queue.enqueue(EFFECT_PURE, this);
857
853
  super._notify(state, skipQueue);
858
854
  }
@@ -911,7 +907,7 @@ var ConditionalQueue = class extends Queue {
911
907
  this._disabled = disabled;
912
908
  }
913
909
  run(type) {
914
- if (type && this._disabled.read())
910
+ if (!type || this._disabled.read())
915
911
  return;
916
912
  return super.run(type);
917
913
  }
@@ -936,6 +932,11 @@ var CollectionQueue = class extends Queue {
936
932
  super();
937
933
  this._collectionType = type;
938
934
  }
935
+ run(type) {
936
+ if (!type || this._disabled.read())
937
+ return;
938
+ return super.run(type);
939
+ }
939
940
  notify(node, type, flags) {
940
941
  if (!(type & this._collectionType))
941
942
  return super.notify(node, type, flags);