@solidjs/signals 0.9.0 → 0.9.1

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
@@ -217,7 +217,7 @@ class GlobalQueue extends Queue {
217
217
  this.stashQueues(activeTransition.queueStash);
218
218
  clock++;
219
219
  scheduled = false;
220
- runPending(activeTransition.pendingNodes, true);
220
+ runTransitionPending(activeTransition.pendingNodes, true);
221
221
  activeTransition = null;
222
222
  return;
223
223
  }
@@ -225,18 +225,14 @@ class GlobalQueue extends Queue {
225
225
  this.restoreQueues(activeTransition.queueStash);
226
226
  transitions.delete(activeTransition);
227
227
  activeTransition = null;
228
- if (runPending(this._pendingNodes, false)) runHeap(dirtyQueue, GlobalQueue._update);
228
+ runTransitionPending(this._pendingNodes, false);
229
+ dirtyQueue._max >= dirtyQueue._min && runHeap(dirtyQueue, GlobalQueue._update);
229
230
  } else if (transitions.size) runHeap(zombieQueue, GlobalQueue._update);
230
- for (let i = 0; i < this._pendingNodes.length; i++) {
231
- const n = this._pendingNodes[i];
232
- if (n._pendingValue !== NOT_PENDING) {
233
- n._value = n._pendingValue;
234
- n._pendingValue = NOT_PENDING;
235
- if (n._type) n._modified = true;
236
- }
237
- if (n._fn) GlobalQueue._dispose(n, false, true);
231
+ runPending(this._pendingNodes);
232
+ while (dirtyQueue._max >= dirtyQueue._min) {
233
+ runHeap(dirtyQueue, GlobalQueue._update);
234
+ runPending(this._pendingNodes);
238
235
  }
239
- this._pendingNodes.length = 0;
240
236
  clock++;
241
237
  scheduled = false;
242
238
  this.run(EFFECT_RENDER);
@@ -277,23 +273,31 @@ class GlobalQueue extends Queue {
277
273
  this._pendingNodes = activeTransition.pendingNodes;
278
274
  }
279
275
  }
280
- function runPending(pendingNodes, value) {
281
- let needsReset = false;
276
+ function runPending(pendingNodes) {
277
+ for (let i = 0; i < pendingNodes.length; i++) {
278
+ const n = pendingNodes[i];
279
+ if (n._pendingValue !== NOT_PENDING) {
280
+ n._value = n._pendingValue;
281
+ n._pendingValue = NOT_PENDING;
282
+ if (n._type) n._modified = true;
283
+ }
284
+ if (n._pendingSignal && n._pendingSignal._pendingValue !== NOT_PENDING)
285
+ n._pendingSignal._set(n._pendingSignal._pendingValue);
286
+ if (n._fn) GlobalQueue._dispose(n, false, true);
287
+ }
288
+ pendingNodes.length = 0;
289
+ }
290
+ function runTransitionPending(pendingNodes, value) {
282
291
  const p = pendingNodes.slice();
283
292
  for (let i = 0; i < p.length; i++) {
284
293
  const n = p[i];
285
294
  n._transition = activeTransition;
286
- if (n._pendingCheck) {
287
- n._pendingCheck._set(value);
288
- needsReset = true;
289
- }
295
+ if (n._pendingCheck) n._pendingCheck._set(value);
290
296
  if (n._pendingSignal && n._pendingSignal._pendingValue !== NOT_PENDING) {
291
297
  n._pendingSignal._set(n._pendingSignal._pendingValue);
292
298
  n._pendingSignal._pendingValue = NOT_PENDING;
293
- needsReset = true;
294
299
  }
295
300
  }
296
- return needsReset;
297
301
  }
298
302
  const globalQueue = new GlobalQueue();
299
303
  function flush() {