@solidjs/signals 0.8.1 → 0.8.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 +45 -22
- package/dist/node.cjs +352 -330
- package/dist/prod.js +352 -329
- package/dist/types/boundaries.d.ts +1 -2
- package/dist/types/core/scheduler.d.ts +11 -2
- package/package.json +1 -1
package/dist/dev.js
CHANGED
|
@@ -205,6 +205,30 @@ var Queue = class {
|
|
|
205
205
|
this._queues[type - 1].push(fn);
|
|
206
206
|
schedule();
|
|
207
207
|
}
|
|
208
|
+
stashQueues(stub) {
|
|
209
|
+
stub._queues[0].push(...this._queues[0]);
|
|
210
|
+
stub._queues[1].push(...this._queues[1]);
|
|
211
|
+
this._queues = [[], []];
|
|
212
|
+
for (let i = 0; i < this._children.length; i++) {
|
|
213
|
+
let child = this._children[i];
|
|
214
|
+
let childStub = stub._children[i];
|
|
215
|
+
if (!childStub) {
|
|
216
|
+
childStub = { _queues: [[], []], _children: [] };
|
|
217
|
+
stub._children[i] = childStub;
|
|
218
|
+
}
|
|
219
|
+
child.stashQueues(childStub);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
restoreQueues(stub) {
|
|
223
|
+
this._queues[0].push(...stub._queues[0]);
|
|
224
|
+
this._queues[1].push(...stub._queues[1]);
|
|
225
|
+
for (let i = 0; i < stub._children.length; i++) {
|
|
226
|
+
const childStub = stub._children[i];
|
|
227
|
+
let child = this._children[i];
|
|
228
|
+
if (child)
|
|
229
|
+
child.restoreQueues(childStub);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
208
232
|
};
|
|
209
233
|
var GlobalQueue = class _GlobalQueue extends Queue {
|
|
210
234
|
_running = false;
|
|
@@ -221,9 +245,7 @@ var GlobalQueue = class _GlobalQueue extends Queue {
|
|
|
221
245
|
if (!transitionComplete(activeTransition)) {
|
|
222
246
|
runHeap(zombieQueue, _GlobalQueue._update);
|
|
223
247
|
globalQueue._pendingNodes = [];
|
|
224
|
-
|
|
225
|
-
activeTransition.queues[1].push(...globalQueue._queues[1]);
|
|
226
|
-
globalQueue._queues = [[], []];
|
|
248
|
+
globalQueue.stashQueues(activeTransition.queueStash);
|
|
227
249
|
clock++;
|
|
228
250
|
scheduled = false;
|
|
229
251
|
runPending(activeTransition.pendingNodes, true);
|
|
@@ -231,8 +253,7 @@ var GlobalQueue = class _GlobalQueue extends Queue {
|
|
|
231
253
|
return;
|
|
232
254
|
}
|
|
233
255
|
globalQueue._pendingNodes.push(...activeTransition.pendingNodes);
|
|
234
|
-
globalQueue.
|
|
235
|
-
globalQueue._queues[1].push(...activeTransition.queues[1]);
|
|
256
|
+
globalQueue.restoreQueues(activeTransition.queueStash);
|
|
236
257
|
transitions.delete(activeTransition);
|
|
237
258
|
activeTransition = null;
|
|
238
259
|
if (runPending(globalQueue._pendingNodes, false))
|
|
@@ -276,7 +297,7 @@ var GlobalQueue = class _GlobalQueue extends Queue {
|
|
|
276
297
|
time: clock,
|
|
277
298
|
pendingNodes: [],
|
|
278
299
|
asyncNodes: [],
|
|
279
|
-
|
|
300
|
+
queueStash: { _queues: [[], []], _children: [] }
|
|
280
301
|
};
|
|
281
302
|
}
|
|
282
303
|
transitions.add(activeTransition);
|
|
@@ -343,6 +364,14 @@ var pendingValueCheck = false;
|
|
|
343
364
|
var pendingCheck = null;
|
|
344
365
|
var context = null;
|
|
345
366
|
var defaultContext = {};
|
|
367
|
+
function notifySubs(node) {
|
|
368
|
+
for (let s = node._subs; s !== null; s = s._nextSub) {
|
|
369
|
+
const queue = s._sub._flags & 32 /* Zombie */ ? zombieQueue : dirtyQueue;
|
|
370
|
+
if (queue._min > s._sub._height)
|
|
371
|
+
queue._min = s._sub._height;
|
|
372
|
+
insertIntoHeap(s._sub, queue);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
346
375
|
function recompute(el, create = false) {
|
|
347
376
|
deleteFromHeap(el, el._flags & 32 /* Zombie */ ? zombieQueue : dirtyQueue);
|
|
348
377
|
if (el._pendingValue !== NOT_PENDING || el._pendingFirstChild || el._pendingDisposal)
|
|
@@ -513,7 +542,7 @@ function setStatusFlags(signal2, flags, error = null) {
|
|
|
513
542
|
signal2._error = error;
|
|
514
543
|
}
|
|
515
544
|
function setError(signal2, error) {
|
|
516
|
-
setStatusFlags(signal2, 2 /* Error
|
|
545
|
+
setStatusFlags(signal2, 2 /* Error */, error);
|
|
517
546
|
}
|
|
518
547
|
function clearStatusFlags(signal2) {
|
|
519
548
|
setStatusFlags(signal2, 0 /* None */);
|
|
@@ -664,6 +693,9 @@ function asyncComputed(asyncFn, initialValue, options) {
|
|
|
664
693
|
return;
|
|
665
694
|
globalQueue.initTransition(self);
|
|
666
695
|
setError(self, e);
|
|
696
|
+
self._time = clock;
|
|
697
|
+
notifySubs(self);
|
|
698
|
+
schedule();
|
|
667
699
|
flush();
|
|
668
700
|
});
|
|
669
701
|
} else {
|
|
@@ -681,6 +713,9 @@ function asyncComputed(asyncFn, initialValue, options) {
|
|
|
681
713
|
return;
|
|
682
714
|
globalQueue.initTransition(self);
|
|
683
715
|
setError(self, error);
|
|
716
|
+
self._time = clock;
|
|
717
|
+
notifySubs(self);
|
|
718
|
+
schedule();
|
|
684
719
|
flush();
|
|
685
720
|
}
|
|
686
721
|
})();
|
|
@@ -831,12 +866,7 @@ function setSignal(el, v) {
|
|
|
831
866
|
}
|
|
832
867
|
clearStatusFlags(el);
|
|
833
868
|
el._time = clock;
|
|
834
|
-
|
|
835
|
-
const queue = s._sub._flags & 32 /* Zombie */ ? zombieQueue : dirtyQueue;
|
|
836
|
-
if (queue._min > s._sub._height)
|
|
837
|
-
queue._min = s._sub._height;
|
|
838
|
-
insertIntoHeap(s._sub, queue);
|
|
839
|
-
}
|
|
869
|
+
notifySubs(el);
|
|
840
870
|
schedule();
|
|
841
871
|
return v;
|
|
842
872
|
}
|
|
@@ -1013,9 +1043,8 @@ function effect(compute, effect2, error, initialValue, options) {
|
|
|
1013
1043
|
}
|
|
1014
1044
|
});
|
|
1015
1045
|
initialized = true;
|
|
1016
|
-
if (node._type === 1 /* Render */)
|
|
1017
|
-
node._fn = (p) =>
|
|
1018
|
-
}
|
|
1046
|
+
if (node._type === 1 /* Render */)
|
|
1047
|
+
node._fn = (p) => staleValues(() => compute(p));
|
|
1019
1048
|
!options?.defer && !(node._statusFlags & (2 /* Error */ | 1 /* Pending */)) && (node._type === 2 /* User */ ? node._queue.enqueue(node._type, runEffect.bind(node)) : runEffect.call(node));
|
|
1020
1049
|
onCleanup(() => node._cleanup?.());
|
|
1021
1050
|
if (!node._parent)
|
|
@@ -2045,12 +2074,6 @@ var CollectionQueue = class extends Queue {
|
|
|
2045
2074
|
return;
|
|
2046
2075
|
return super.run(type);
|
|
2047
2076
|
}
|
|
2048
|
-
enqueue(type, fn) {
|
|
2049
|
-
if (this._collectionType & 1 /* Pending */ && this._initialized) {
|
|
2050
|
-
return this._parent?.enqueue(type, fn);
|
|
2051
|
-
}
|
|
2052
|
-
return super.enqueue(type, fn);
|
|
2053
|
-
}
|
|
2054
2077
|
notify(node, type, flags) {
|
|
2055
2078
|
if (!(type & this._collectionType) || this._collectionType & 1 /* Pending */ && this._initialized)
|
|
2056
2079
|
return super.notify(node, type, flags);
|