@tanstack/solid-query-devtools 6.0.0-alpha.0 → 6.0.0-alpha.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.
@@ -1,8 +1,8 @@
1
1
  import { createRenderEffect, untrack as untrack$1, runWithOwner, sharedConfig } from 'solid-js';
2
2
 
3
- // ../../node_modules/.pnpm/@solidjs+web@2.0.0-beta.2_@solidjs+signals@0.12.0_solid-js@2.0.0-beta.2/node_modules/@solidjs/web/dist/dev.js
3
+ // ../../node_modules/.pnpm/@solidjs+web@2.0.0-beta.4_@solidjs+signals@0.13.6_solid-js@2.0.0-beta.4/node_modules/@solidjs/web/dist/dev.js
4
4
 
5
- // ../../node_modules/.pnpm/@solidjs+signals@0.12.0/node_modules/@solidjs/signals/dist/dev.js
5
+ // ../../node_modules/.pnpm/@solidjs+signals@0.13.6/node_modules/@solidjs/signals/dist/dev.js
6
6
  var NotReadyError = class extends Error {
7
7
  source;
8
8
  constructor(source) {
@@ -113,7 +113,8 @@ var clock = 0;
113
113
  var activeTransition = null;
114
114
  var scheduled = false;
115
115
  var projectionWriteActive = false;
116
- var _onUnhandledAsync = null;
116
+ var inTrackedQueueCallback = false;
117
+ var stashedOptimisticReads = null;
117
118
  function runLaneEffects(type) {
118
119
  for (const lane of activeLanes) {
119
120
  if (lane._mergedInto || lane._pendingAsync.size > 0) continue;
@@ -124,6 +125,65 @@ function runLaneEffects(type) {
124
125
  }
125
126
  }
126
127
  }
128
+ function queueStashedOptimisticEffects(node) {
129
+ for (let s = node._subs; s !== null; s = s._nextSub) {
130
+ const sub = s._sub;
131
+ if (!sub._type) continue;
132
+ if (sub._type === EFFECT_TRACKED) {
133
+ if (!sub._modified) {
134
+ sub._modified = true;
135
+ sub._queue.enqueue(EFFECT_USER, sub._run);
136
+ }
137
+ continue;
138
+ }
139
+ const queue = sub._flags & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
140
+ if (queue._min > sub._height) queue._min = sub._height;
141
+ insertIntoHeap(sub, queue);
142
+ }
143
+ }
144
+ function mergeTransitionState(target, outgoing) {
145
+ outgoing._done = target;
146
+ target._actions.push(...outgoing._actions);
147
+ for (const lane of activeLanes) {
148
+ if (lane._transition === outgoing) lane._transition = target;
149
+ }
150
+ target._optimisticNodes.push(...outgoing._optimisticNodes);
151
+ for (const store of outgoing._optimisticStores) target._optimisticStores.add(store);
152
+ for (const node of outgoing._asyncNodes) {
153
+ if (!target._asyncNodes.includes(node)) target._asyncNodes.push(node);
154
+ }
155
+ }
156
+ function resolveOptimisticNodes(nodes) {
157
+ for (let i = 0; i < nodes.length; i++) {
158
+ const node = nodes[i];
159
+ node._optimisticLane = void 0;
160
+ if (node._pendingValue !== NOT_PENDING) {
161
+ node._value = node._pendingValue;
162
+ node._pendingValue = NOT_PENDING;
163
+ }
164
+ const prevOverride = node._overrideValue;
165
+ node._overrideValue = NOT_PENDING;
166
+ if (prevOverride !== NOT_PENDING && node._value !== prevOverride) insertSubs(node, true);
167
+ node._transition = null;
168
+ }
169
+ nodes.length = 0;
170
+ }
171
+ function cleanupCompletedLanes(completingTransition) {
172
+ for (const lane of activeLanes) {
173
+ const owned = completingTransition ? lane._transition === completingTransition : !lane._transition;
174
+ if (!owned) continue;
175
+ if (!lane._mergedInto) {
176
+ if (lane._effectQueues[0].length) runQueue(lane._effectQueues[0], EFFECT_RENDER);
177
+ if (lane._effectQueues[1].length) runQueue(lane._effectQueues[1], EFFECT_USER);
178
+ }
179
+ if (lane._source._optimisticLane === lane) lane._source._optimisticLane = void 0;
180
+ lane._pendingAsync.clear();
181
+ lane._effectQueues[0].length = 0;
182
+ lane._effectQueues[1].length = 0;
183
+ activeLanes.delete(lane);
184
+ signalLanes.delete(lane._source);
185
+ }
186
+ }
127
187
  function schedule() {
128
188
  if (scheduled) return;
129
189
  scheduled = true;
@@ -208,19 +268,32 @@ var GlobalQueue = class _GlobalQueue extends Queue {
208
268
  if (activeTransition) {
209
269
  const isComplete = transitionComplete(activeTransition);
210
270
  if (!isComplete) {
211
- let t = activeTransition;
271
+ const stashedTransition = activeTransition;
212
272
  runHeap(zombieQueue, _GlobalQueue._update);
213
273
  this._pendingNodes = [];
214
274
  this._optimisticNodes = [];
215
275
  this._optimisticStores = /* @__PURE__ */ new Set();
216
276
  runLaneEffects(EFFECT_RENDER);
217
277
  runLaneEffects(EFFECT_USER);
218
- this.stashQueues(activeTransition._queueStash);
278
+ this.stashQueues(stashedTransition._queueStash);
219
279
  clock++;
220
280
  scheduled = dirtyQueue._max >= dirtyQueue._min;
221
- reassignPendingTransition(activeTransition._pendingNodes);
281
+ reassignPendingTransition(stashedTransition._pendingNodes);
222
282
  activeTransition = null;
223
- finalizePureQueue(null, true);
283
+ if (!stashedTransition._actions.length && stashedTransition._optimisticNodes.length) {
284
+ stashedOptimisticReads = /* @__PURE__ */ new Set();
285
+ for (let i = 0; i < stashedTransition._optimisticNodes.length; i++) {
286
+ const node = stashedTransition._optimisticNodes[i];
287
+ if (node._fn || node._pureWrite) continue;
288
+ stashedOptimisticReads.add(node);
289
+ queueStashedOptimisticEffects(node);
290
+ }
291
+ }
292
+ try {
293
+ finalizePureQueue(null, true);
294
+ } finally {
295
+ stashedOptimisticReads = null;
296
+ }
224
297
  return;
225
298
  }
226
299
  this._pendingNodes !== activeTransition._pendingNodes && this._pendingNodes.push(...activeTransition._pendingNodes);
@@ -246,14 +319,14 @@ var GlobalQueue = class _GlobalQueue extends Queue {
246
319
  }
247
320
  notify(node, mask, flags, error) {
248
321
  if (mask & STATUS_PENDING) {
249
- if (_onUnhandledAsync && flags & STATUS_PENDING) {
250
- _onUnhandledAsync();
251
- }
252
322
  if (flags & STATUS_PENDING) {
253
323
  const actualError = error !== void 0 ? error : node._error;
254
- if (activeTransition && actualError && !activeTransition._asyncNodes.includes(actualError.source)) {
255
- activeTransition._asyncNodes.push(actualError.source);
256
- schedule();
324
+ if (activeTransition && actualError) {
325
+ const source = actualError.source;
326
+ if (!activeTransition._asyncNodes.includes(source)) {
327
+ activeTransition._asyncNodes.push(source);
328
+ schedule();
329
+ }
257
330
  }
258
331
  }
259
332
  return true;
@@ -277,37 +350,35 @@ var GlobalQueue = class _GlobalQueue extends Queue {
277
350
  };
278
351
  } else if (transition) {
279
352
  const outgoing = activeTransition;
280
- outgoing._done = transition;
281
- transition._actions.push(...outgoing._actions);
282
- for (const lane of activeLanes) {
283
- if (lane._transition === outgoing) lane._transition = transition;
284
- }
285
- transition._optimisticNodes.push(...outgoing._optimisticNodes);
286
- for (const store of outgoing._optimisticStores) {
287
- transition._optimisticStores.add(store);
288
- }
353
+ mergeTransitionState(transition, outgoing);
289
354
  transitions.delete(outgoing);
290
355
  activeTransition = transition;
291
356
  }
292
357
  transitions.add(activeTransition);
293
358
  activeTransition._time = clock;
294
- for (let i = 0; i < this._pendingNodes.length; i++) {
295
- const n = this._pendingNodes[i];
296
- n._transition = activeTransition;
297
- activeTransition._pendingNodes.push(n);
359
+ if (this._pendingNodes !== activeTransition._pendingNodes) {
360
+ for (let i = 0; i < this._pendingNodes.length; i++) {
361
+ const node = this._pendingNodes[i];
362
+ node._transition = activeTransition;
363
+ activeTransition._pendingNodes.push(node);
364
+ }
365
+ this._pendingNodes = activeTransition._pendingNodes;
298
366
  }
299
- this._pendingNodes = activeTransition._pendingNodes;
300
- for (let i = 0; i < this._optimisticNodes.length; i++) {
301
- const node = this._optimisticNodes[i];
302
- node._transition = activeTransition;
303
- activeTransition._optimisticNodes.push(node);
367
+ if (this._optimisticNodes !== activeTransition._optimisticNodes) {
368
+ for (let i = 0; i < this._optimisticNodes.length; i++) {
369
+ const node = this._optimisticNodes[i];
370
+ node._transition = activeTransition;
371
+ activeTransition._optimisticNodes.push(node);
372
+ }
373
+ this._optimisticNodes = activeTransition._optimisticNodes;
304
374
  }
305
- this._optimisticNodes = activeTransition._optimisticNodes;
306
375
  for (const lane of activeLanes) {
307
376
  if (!lane._transition) lane._transition = activeTransition;
308
377
  }
309
- for (const store of this._optimisticStores) activeTransition._optimisticStores.add(store);
310
- this._optimisticStores = activeTransition._optimisticStores;
378
+ if (this._optimisticStores !== activeTransition._optimisticStores) {
379
+ for (const store of this._optimisticStores) activeTransition._optimisticStores.add(store);
380
+ this._optimisticStores = activeTransition._optimisticStores;
381
+ }
311
382
  }
312
383
  };
313
384
  function insertSubs(node, optimistic = false) {
@@ -338,36 +409,30 @@ function insertSubs(node, optimistic = false) {
338
409
  insertIntoHeap(s._sub, queue);
339
410
  }
340
411
  }
412
+ function commitPendingNodes() {
413
+ const pendingNodes = globalQueue._pendingNodes;
414
+ for (let i = 0; i < pendingNodes.length; i++) {
415
+ const n = pendingNodes[i];
416
+ if (n._pendingValue !== NOT_PENDING) {
417
+ n._value = n._pendingValue;
418
+ n._pendingValue = NOT_PENDING;
419
+ if (n._type && n._type !== EFFECT_TRACKED) n._modified = true;
420
+ }
421
+ if (!(n._statusFlags & STATUS_PENDING)) n._statusFlags &= ~STATUS_UNINITIALIZED;
422
+ if (n._fn) GlobalQueue._dispose(n, false, true);
423
+ }
424
+ pendingNodes.length = 0;
425
+ }
341
426
  function finalizePureQueue(completingTransition = null, incomplete = false) {
342
- let resolvePending = !incomplete;
427
+ const resolvePending = !incomplete;
428
+ if (resolvePending) commitPendingNodes();
343
429
  if (!incomplete) checkBoundaryChildren(globalQueue);
344
430
  if (dirtyQueue._max >= dirtyQueue._min) runHeap(dirtyQueue, GlobalQueue._update);
345
431
  if (resolvePending) {
346
- const pendingNodes = globalQueue._pendingNodes;
347
- for (let i = 0; i < pendingNodes.length; i++) {
348
- const n = pendingNodes[i];
349
- if (n._pendingValue !== NOT_PENDING) {
350
- n._value = n._pendingValue;
351
- n._pendingValue = NOT_PENDING;
352
- if (n._type && n._type !== EFFECT_TRACKED) n._modified = true;
353
- }
354
- if (!(n._statusFlags & STATUS_PENDING)) n._statusFlags &= ~STATUS_UNINITIALIZED;
355
- if (n._fn) GlobalQueue._dispose(n, false, true);
356
- }
357
- pendingNodes.length = 0;
358
- const optimisticNodes = completingTransition ? completingTransition._optimisticNodes : globalQueue._optimisticNodes;
359
- for (let i = 0; i < optimisticNodes.length; i++) {
360
- const n = optimisticNodes[i];
361
- const original = n._pendingValue;
362
- n._optimisticLane = void 0;
363
- if (original !== NOT_PENDING && n._value !== original) {
364
- n._value = original;
365
- insertSubs(n, true);
366
- }
367
- n._pendingValue = NOT_PENDING;
368
- n._transition = null;
369
- }
370
- optimisticNodes.length = 0;
432
+ commitPendingNodes();
433
+ resolveOptimisticNodes(
434
+ completingTransition ? completingTransition._optimisticNodes : globalQueue._optimisticNodes
435
+ );
371
436
  const optimisticStores = completingTransition ? completingTransition._optimisticStores : globalQueue._optimisticStores;
372
437
  if (GlobalQueue._clearOptimisticStore && optimisticStores.size) {
373
438
  for (const store of optimisticStores) {
@@ -376,20 +441,7 @@ function finalizePureQueue(completingTransition = null, incomplete = false) {
376
441
  optimisticStores.clear();
377
442
  schedule();
378
443
  }
379
- for (const lane of activeLanes) {
380
- const owned = completingTransition ? lane._transition === completingTransition : !lane._transition;
381
- if (!owned) continue;
382
- if (!lane._mergedInto) {
383
- if (lane._effectQueues[0].length) runQueue(lane._effectQueues[0], EFFECT_RENDER);
384
- if (lane._effectQueues[1].length) runQueue(lane._effectQueues[1], EFFECT_USER);
385
- }
386
- if (lane._source._optimisticLane === lane) lane._source._optimisticLane = void 0;
387
- lane._pendingAsync.clear();
388
- lane._effectQueues[0].length = 0;
389
- lane._effectQueues[1].length = 0;
390
- activeLanes.delete(lane);
391
- signalLanes.delete(lane._source);
392
- }
444
+ cleanupCompletedLanes(completingTransition);
393
445
  }
394
446
  }
395
447
  function checkBoundaryChildren(queue) {
@@ -405,8 +457,16 @@ function reassignPendingTransition(pendingNodes) {
405
457
  }
406
458
  var globalQueue = new GlobalQueue();
407
459
  function flush() {
460
+ if (globalQueue._running) {
461
+ if (inTrackedQueueCallback) {
462
+ throw new Error(
463
+ "Cannot call flush() from inside onSettled or createTrackedEffect. flush() is not reentrant there."
464
+ );
465
+ }
466
+ return;
467
+ }
408
468
  let count = 0;
409
- while (scheduled) {
469
+ while (scheduled || activeTransition) {
410
470
  if (++count === 1e5) throw new Error("Potential Infinite Loop Detected.");
411
471
  globalQueue.flush();
412
472
  }
@@ -425,6 +485,15 @@ function transitionComplete(transition) {
425
485
  break;
426
486
  }
427
487
  }
488
+ if (done) {
489
+ for (let i = 0; i < transition._optimisticNodes.length; i++) {
490
+ const node = transition._optimisticNodes[i];
491
+ if (hasActiveOverride(node) && "_statusFlags" in node && node._statusFlags & STATUS_PENDING && node._error instanceof NotReadyError && node._error.source !== node) {
492
+ done = false;
493
+ break;
494
+ }
495
+ }
496
+ }
428
497
  done && (transition._done = true);
429
498
  return done;
430
499
  }
@@ -460,7 +529,7 @@ function getOrCreateLane(signal) {
460
529
  };
461
530
  signalLanes.set(signal, lane);
462
531
  activeLanes.add(lane);
463
- signal._laneVersion = signal._overrideVersion || 0;
532
+ signal._overrideSinceLane = false;
464
533
  return lane;
465
534
  }
466
535
  function findLane(lane) {
@@ -485,8 +554,11 @@ function resolveLane(el) {
485
554
  el._optimisticLane = void 0;
486
555
  return void 0;
487
556
  }
557
+ function resolveTransition(el) {
558
+ return resolveLane(el)?._transition ?? el._transition;
559
+ }
488
560
  function hasActiveOverride(el) {
489
- return !!(el._optimistic && el._pendingValue !== NOT_PENDING);
561
+ return !!(el._overrideValue !== void 0 && el._overrideValue !== NOT_PENDING);
490
562
  }
491
563
  function assignOrMergeLane(el, sourceLane) {
492
564
  const sourceRoot = findLane(sourceLane);
@@ -509,6 +581,96 @@ function assignOrMergeLane(el, sourceLane) {
509
581
  }
510
582
  el._optimisticLane = sourceLane;
511
583
  }
584
+ function addPendingSource(el, source) {
585
+ if (el._pendingSource === source || el._pendingSources?.has(source)) return false;
586
+ if (!el._pendingSource) {
587
+ el._pendingSource = source;
588
+ return true;
589
+ }
590
+ if (!el._pendingSources) {
591
+ el._pendingSources = /* @__PURE__ */ new Set([el._pendingSource, source]);
592
+ } else {
593
+ el._pendingSources.add(source);
594
+ }
595
+ el._pendingSource = void 0;
596
+ return true;
597
+ }
598
+ function removePendingSource(el, source) {
599
+ if (el._pendingSource) {
600
+ if (el._pendingSource !== source) return false;
601
+ el._pendingSource = void 0;
602
+ return true;
603
+ }
604
+ if (!el._pendingSources?.delete(source)) return false;
605
+ if (el._pendingSources.size === 1) {
606
+ el._pendingSource = el._pendingSources.values().next().value;
607
+ el._pendingSources = void 0;
608
+ } else if (el._pendingSources.size === 0) {
609
+ el._pendingSources = void 0;
610
+ }
611
+ return true;
612
+ }
613
+ function clearPendingSources(el) {
614
+ el._pendingSource = void 0;
615
+ el._pendingSources?.clear();
616
+ el._pendingSources = void 0;
617
+ }
618
+ function setPendingError(el, source, error) {
619
+ if (!source) {
620
+ el._error = null;
621
+ return;
622
+ }
623
+ if (error instanceof NotReadyError && error.source === source) {
624
+ el._error = error;
625
+ return;
626
+ }
627
+ const current = el._error;
628
+ if (!(current instanceof NotReadyError) || current.source !== source) {
629
+ el._error = new NotReadyError(source);
630
+ }
631
+ }
632
+ function forEachDependent(el, fn) {
633
+ for (let s = el._subs; s !== null; s = s._nextSub) fn(s._sub);
634
+ for (let child = el._child; child !== null; child = child._nextChild) {
635
+ for (let s = child._subs; s !== null; s = s._nextSub) fn(s._sub);
636
+ }
637
+ }
638
+ function settlePendingSource(el) {
639
+ let scheduled2 = false;
640
+ const visited = /* @__PURE__ */ new Set();
641
+ const settle = (node) => {
642
+ if (visited.has(node) || !removePendingSource(node, el)) return;
643
+ visited.add(node);
644
+ node._time = clock;
645
+ const source = node._pendingSource ?? node._pendingSources?.values().next().value;
646
+ if (source) {
647
+ setPendingError(node, source);
648
+ updatePendingSignal(node);
649
+ } else {
650
+ node._statusFlags &= ~STATUS_PENDING;
651
+ setPendingError(node);
652
+ updatePendingSignal(node);
653
+ if (node._blocked) {
654
+ if (node._type === EFFECT_TRACKED) {
655
+ const tracked = node;
656
+ if (!tracked._modified) {
657
+ tracked._modified = true;
658
+ tracked._queue.enqueue(EFFECT_USER, tracked._run);
659
+ }
660
+ } else {
661
+ const queue = node._flags & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
662
+ if (queue._min > node._height) queue._min = node._height;
663
+ insertIntoHeap(node, queue);
664
+ }
665
+ scheduled2 = true;
666
+ }
667
+ node._blocked = false;
668
+ }
669
+ forEachDependent(node, settle);
670
+ };
671
+ forEachDependent(el, settle);
672
+ if (scheduled2) schedule();
673
+ }
512
674
  function handleAsync(el, result, setter) {
513
675
  const isObject = typeof result === "object" && result !== null;
514
676
  const iterator = isObject && untrack(() => result[Symbol.asyncIterator]);
@@ -521,21 +683,21 @@ function handleAsync(el, result, setter) {
521
683
  let syncValue;
522
684
  const handleError = (error) => {
523
685
  if (el._inFlight !== result) return;
524
- globalQueue.initTransition(el._transition);
686
+ globalQueue.initTransition(resolveTransition(el));
525
687
  notifyStatus(el, error instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, error);
526
688
  el._time = clock;
527
689
  };
528
690
  const asyncWrite = (value, then) => {
529
691
  if (el._inFlight !== result) return;
530
692
  if (el._flags & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
531
- globalQueue.initTransition(el._transition);
693
+ globalQueue.initTransition(resolveTransition(el));
532
694
  clearStatus(el);
533
695
  const lane = resolveLane(el);
534
696
  if (lane) lane._pendingAsync.delete(el);
535
- if (el._optimistic) {
536
- const hadOverride = el._pendingValue !== NOT_PENDING;
537
- if (el._fn) el._pendingValue = value;
538
- if (!hadOverride) {
697
+ if (el._overrideValue !== void 0) {
698
+ if (el._overrideValue !== void 0 && el._overrideValue !== NOT_PENDING)
699
+ el._pendingValue = value;
700
+ else {
539
701
  el._value = value;
540
702
  insertSubs(el);
541
703
  }
@@ -554,6 +716,7 @@ function handleAsync(el, result, setter) {
554
716
  } else {
555
717
  setSignal(el, () => value);
556
718
  }
719
+ settlePendingSource(el);
557
720
  schedule();
558
721
  flush();
559
722
  then?.();
@@ -573,7 +736,7 @@ function handleAsync(el, result, setter) {
573
736
  );
574
737
  isSync = false;
575
738
  if (!resolved) {
576
- globalQueue.initTransition(el._transition);
739
+ globalQueue.initTransition(resolveTransition(el));
577
740
  throw new NotReadyError(context);
578
741
  }
579
742
  }
@@ -607,41 +770,48 @@ function handleAsync(el, result, setter) {
607
770
  };
608
771
  const immediatelyDone = iterate();
609
772
  if (!hadSyncValue && !immediatelyDone) {
610
- globalQueue.initTransition(el._transition);
773
+ globalQueue.initTransition(resolveTransition(el));
611
774
  throw new NotReadyError(context);
612
775
  }
613
776
  }
614
777
  return syncValue;
615
778
  }
616
- function clearStatus(el) {
617
- el._statusFlags = el._statusFlags & STATUS_UNINITIALIZED;
618
- el._error = null;
779
+ function clearStatus(el, clearUninitialized = false) {
780
+ clearPendingSources(el);
781
+ el._blocked = false;
782
+ el._statusFlags = clearUninitialized ? 0 : el._statusFlags & STATUS_UNINITIALIZED;
783
+ setPendingError(el);
619
784
  updatePendingSignal(el);
620
785
  el._notifyStatus?.();
621
786
  }
622
787
  function notifyStatus(el, status, error, blockStatus, lane) {
623
788
  if (status === STATUS_ERROR && !(error instanceof StatusError) && !(error instanceof NotReadyError))
624
789
  error = new StatusError(el, error);
625
- const isSource = error instanceof NotReadyError && error.source === el;
626
- const isOptimisticBoundary = status === STATUS_PENDING && el._optimistic && !isSource;
790
+ const pendingSource = status === STATUS_PENDING && error instanceof NotReadyError ? error.source : void 0;
791
+ const isSource = pendingSource === el;
792
+ const isOptimisticBoundary = status === STATUS_PENDING && el._overrideValue !== void 0 && !isSource;
627
793
  const startsBlocking = isOptimisticBoundary && hasActiveOverride(el);
628
794
  if (!blockStatus) {
629
- el._statusFlags = status | (status !== STATUS_ERROR ? el._statusFlags & STATUS_UNINITIALIZED : 0);
630
- el._error = error;
795
+ if (status === STATUS_PENDING && pendingSource) {
796
+ addPendingSource(el, pendingSource);
797
+ el._statusFlags = STATUS_PENDING | el._statusFlags & STATUS_UNINITIALIZED;
798
+ setPendingError(el, pendingSource, error);
799
+ } else {
800
+ clearPendingSources(el);
801
+ el._statusFlags = status | (status !== STATUS_ERROR ? el._statusFlags & STATUS_UNINITIALIZED : 0);
802
+ el._error = error;
803
+ }
631
804
  updatePendingSignal(el);
632
805
  }
633
806
  if (lane && !blockStatus) {
634
807
  assignOrMergeLane(el, lane);
635
808
  }
636
- if (startsBlocking && activeTransition && error instanceof NotReadyError) {
637
- const source = error.source;
638
- if (!activeTransition._asyncNodes.includes(source)) {
639
- activeTransition._asyncNodes.push(source);
640
- }
641
- }
642
809
  const downstreamBlockStatus = blockStatus || startsBlocking;
643
810
  const downstreamLane = blockStatus || isOptimisticBoundary ? void 0 : lane;
644
811
  if (el._notifyStatus) {
812
+ if (blockStatus && status === STATUS_PENDING) {
813
+ return;
814
+ }
645
815
  if (downstreamBlockStatus) {
646
816
  el._notifyStatus(status, error);
647
817
  } else {
@@ -649,49 +819,15 @@ function notifyStatus(el, status, error, blockStatus, lane) {
649
819
  }
650
820
  return;
651
821
  }
652
- for (let s = el._subs; s !== null; s = s._nextSub) {
653
- s._sub._time = clock;
654
- if (s._sub._error !== error) {
655
- !s._sub._transition && globalQueue._pendingNodes.push(s._sub);
656
- notifyStatus(s._sub, status, error, downstreamBlockStatus, downstreamLane);
657
- }
658
- }
659
- for (let child = el._child; child !== null; child = child._nextChild) {
660
- for (let s = child._subs; s !== null; s = s._nextSub) {
661
- s._sub._time = clock;
662
- if (s._sub._error !== error) {
663
- !s._sub._transition && globalQueue._pendingNodes.push(s._sub);
664
- notifyStatus(s._sub, status, error, downstreamBlockStatus, downstreamLane);
665
- }
666
- }
667
- }
668
- }
669
- function unlinkSubs(link) {
670
- const dep = link._dep;
671
- const nextDep = link._nextDep;
672
- const nextSub = link._nextSub;
673
- const prevSub = link._prevSub;
674
- if (nextSub !== null) nextSub._prevSub = prevSub;
675
- else dep._subsTail = prevSub;
676
- if (prevSub !== null) prevSub._nextSub = nextSub;
677
- else {
678
- dep._subs = nextSub;
679
- if (nextSub === null) {
680
- dep._unobserved?.();
681
- dep._fn && !dep._preventAutoDisposal && !(dep._flags & REACTIVE_ZOMBIE) && unobserved(dep);
822
+ forEachDependent(el, (sub) => {
823
+ sub._time = clock;
824
+ if (status === STATUS_PENDING && pendingSource && sub._pendingSource !== pendingSource && !sub._pendingSources?.has(pendingSource) || status !== STATUS_PENDING && (sub._error !== error || sub._pendingSource || sub._pendingSources)) {
825
+ if (!downstreamBlockStatus && !sub._transition) globalQueue._pendingNodes.push(sub);
826
+ notifyStatus(sub, status, error, downstreamBlockStatus, downstreamLane);
682
827
  }
683
- }
684
- return nextDep;
685
- }
686
- function unobserved(el) {
687
- deleteFromHeap(el, el._flags & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
688
- let dep = el._deps;
689
- while (dep !== null) {
690
- dep = unlinkSubs(dep);
691
- }
692
- el._deps = null;
693
- disposeChildren(el, true);
828
+ });
694
829
  }
830
+ var externalSourceConfig = null;
695
831
  function markDisposal(el) {
696
832
  let child = el._firstChild;
697
833
  while (child) {
@@ -727,7 +863,6 @@ function disposeChildren(node, self = false, zombie) {
727
863
  node._pendingFirstChild = null;
728
864
  } else {
729
865
  node._firstChild = null;
730
- node._nextSibling = null;
731
866
  node._childCount = 0;
732
867
  }
733
868
  runDisposal(node, zombie);
@@ -745,7 +880,32 @@ function runDisposal(node, zombie) {
745
880
  }
746
881
  zombie ? node._pendingDisposal = null : node._disposal = null;
747
882
  }
748
- var leafEffectActive = false;
883
+ function unlinkSubs(link) {
884
+ const dep = link._dep;
885
+ const nextDep = link._nextDep;
886
+ const nextSub = link._nextSub;
887
+ const prevSub = link._prevSub;
888
+ if (nextSub !== null) nextSub._prevSub = prevSub;
889
+ else dep._subsTail = prevSub;
890
+ if (prevSub !== null) prevSub._nextSub = nextSub;
891
+ else {
892
+ dep._subs = nextSub;
893
+ if (nextSub === null) {
894
+ dep._unobserved?.();
895
+ dep._fn && !dep._preventAutoDisposal && !(dep._flags & REACTIVE_ZOMBIE) && unobserved(dep);
896
+ }
897
+ }
898
+ return nextDep;
899
+ }
900
+ function unobserved(el) {
901
+ deleteFromHeap(el, el._flags & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
902
+ let dep = el._deps;
903
+ while (dep !== null) {
904
+ dep = unlinkSubs(dep);
905
+ }
906
+ el._deps = null;
907
+ disposeChildren(el, true);
908
+ }
749
909
  GlobalQueue._update = recompute;
750
910
  GlobalQueue._dispose = disposeChildren;
751
911
  var tracking = false;
@@ -768,7 +928,7 @@ function recompute(el, create = false) {
768
928
  }
769
929
  }
770
930
  const isOptimisticDirty = !!(el._flags & REACTIVE_OPTIMISTIC_DIRTY);
771
- const hasOverride = hasActiveOverride(el);
931
+ const hasOverride = el._overrideValue !== void 0 && el._overrideValue !== NOT_PENDING;
772
932
  const wasPending = !!(el._statusFlags & STATUS_PENDING);
773
933
  const oldcontext = context;
774
934
  context = el;
@@ -791,7 +951,7 @@ function recompute(el, create = false) {
791
951
  }
792
952
  try {
793
953
  value = handleAsync(el, el._fn(value));
794
- clearStatus(el);
954
+ clearStatus(el, create);
795
955
  const resolvedLane = resolveLane(el);
796
956
  if (resolvedLane) {
797
957
  resolvedLane._pendingAsync.delete(el);
@@ -806,6 +966,7 @@ function recompute(el, create = false) {
806
966
  updatePendingSignal(lane._source);
807
967
  }
808
968
  }
969
+ if (e instanceof NotReadyError) el._blocked = true;
809
970
  notifyStatus(
810
971
  el,
811
972
  e instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
@@ -829,21 +990,21 @@ function recompute(el, create = false) {
829
990
  if (depsTail !== null) depsTail._nextDep = null;
830
991
  else el._deps = null;
831
992
  }
832
- const compareValue = hasOverride ? el._value : el._pendingValue === NOT_PENDING ? el._value : el._pendingValue;
993
+ const compareValue = hasOverride ? el._overrideValue : el._pendingValue === NOT_PENDING ? el._value : el._pendingValue;
833
994
  const valueChanged = !el._equals || !el._equals(compareValue, value);
834
995
  if (valueChanged) {
835
- const prevVisible = hasOverride ? el._value : void 0;
836
- if (create || isEffect && activeTransition !== el._transition || isOptimisticDirty)
996
+ const prevVisible = hasOverride ? el._overrideValue : void 0;
997
+ if (create || isEffect && activeTransition !== el._transition || isOptimisticDirty) {
837
998
  el._value = value;
838
- else el._pendingValue = value;
839
- if (hasOverride && !isOptimisticDirty && wasPending) {
840
- const ov = el._overrideVersion || 0;
841
- const lv = el._laneVersion || 0;
842
- if (ov <= lv) el._value = value;
843
- }
844
- if (!hasOverride || isOptimisticDirty || el._value !== prevVisible) {
999
+ if (hasOverride && isOptimisticDirty) {
1000
+ el._overrideValue = value;
1001
+ el._pendingValue = value;
1002
+ }
1003
+ } else el._pendingValue = value;
1004
+ if (hasOverride && !isOptimisticDirty && wasPending && !el._overrideSinceLane)
1005
+ el._overrideValue = value;
1006
+ if (!hasOverride || isOptimisticDirty || el._overrideValue !== prevVisible)
845
1007
  insertSubs(el, isOptimisticDirty || hasOverride);
846
- }
847
1008
  } else if (hasOverride) {
848
1009
  el._pendingValue = value;
849
1010
  } else if (el._height != oldHeight) {
@@ -853,17 +1014,18 @@ function recompute(el, create = false) {
853
1014
  }
854
1015
  }
855
1016
  currentOptimisticLane = prevLane;
856
- (!create || el._statusFlags & STATUS_PENDING) && !el._transition && !(activeTransition && el._optimistic) && globalQueue._pendingNodes.push(el);
1017
+ (!create || el._statusFlags & STATUS_PENDING) && !el._transition && !(activeTransition && hasOverride) && globalQueue._pendingNodes.push(el);
857
1018
  el._transition && isEffect && activeTransition !== el._transition && runInTransition(el._transition, () => recompute(el));
858
1019
  }
859
1020
  var strictRead = false;
860
1021
  function untrack(fn, strictReadLabel) {
861
- if (!tracking && !strictRead && true) return fn();
1022
+ if (!externalSourceConfig && !tracking && !strictRead && true) return fn();
862
1023
  const prevTracking = tracking;
863
1024
  const prevStrictRead = strictRead;
864
1025
  tracking = false;
865
1026
  strictRead = false;
866
1027
  try {
1028
+ if (externalSourceConfig) return externalSourceConfig.untrack(fn);
867
1029
  return fn();
868
1030
  } finally {
869
1031
  tracking = prevTracking;
@@ -871,36 +1033,33 @@ function untrack(fn, strictReadLabel) {
871
1033
  }
872
1034
  }
873
1035
  function setSignal(el, v) {
874
- if (!el._pureWrite && !leafEffectActive && context && el._firewall !== context)
1036
+ if (!el._pureWrite && !context?._childrenForbidden && context && el._firewall !== context)
875
1037
  console.warn("A Signal was written to in an owned scope.");
876
1038
  if (el._transition && activeTransition !== el._transition)
877
1039
  globalQueue.initTransition(el._transition);
878
- const isOptimistic = el._optimistic && !projectionWriteActive;
879
- const currentValue = isOptimistic ? el._value : el._pendingValue === NOT_PENDING ? el._value : el._pendingValue;
1040
+ const isOptimistic = el._overrideValue !== void 0 && !projectionWriteActive;
1041
+ const hasOverride = el._overrideValue !== void 0 && el._overrideValue !== NOT_PENDING;
1042
+ const currentValue = isOptimistic ? hasOverride ? el._overrideValue : el._value : el._pendingValue === NOT_PENDING ? el._value : el._pendingValue;
880
1043
  if (typeof v === "function") v = v(currentValue);
881
1044
  const valueChanged = !el._equals || !el._equals(currentValue, v) || !!(el._statusFlags & STATUS_UNINITIALIZED);
882
1045
  if (!valueChanged) {
883
- if (isOptimistic && el._pendingValue !== NOT_PENDING && el._fn) {
1046
+ if (isOptimistic && hasOverride && el._fn) {
884
1047
  insertSubs(el, true);
885
1048
  schedule();
886
1049
  }
887
1050
  return v;
888
1051
  }
889
1052
  if (isOptimistic) {
890
- const alreadyTracked = globalQueue._optimisticNodes.includes(el);
891
- if (el._transition && alreadyTracked) {
892
- globalQueue.initTransition(el._transition);
893
- }
894
- if (el._pendingValue === NOT_PENDING) {
1053
+ const firstOverride = el._overrideValue === NOT_PENDING;
1054
+ if (!firstOverride) globalQueue.initTransition(resolveTransition(el));
1055
+ if (firstOverride) {
895
1056
  el._pendingValue = el._value;
896
- }
897
- if (!alreadyTracked) {
898
1057
  globalQueue._optimisticNodes.push(el);
899
1058
  }
900
- el._overrideVersion = (el._overrideVersion || 0) + 1;
1059
+ el._overrideSinceLane = true;
901
1060
  const lane = getOrCreateLane(el);
902
1061
  el._optimisticLane = lane;
903
- el._value = v;
1062
+ el._overrideValue = v;
904
1063
  } else {
905
1064
  if (el._pendingValue === NOT_PENDING) globalQueue._pendingNodes.push(el);
906
1065
  el._pendingValue = v;
@@ -916,7 +1075,11 @@ function setSignal(el, v) {
916
1075
  }
917
1076
  function computePendingState(el) {
918
1077
  const comp = el;
919
- if (el._optimistic && el._pendingValue !== NOT_PENDING) {
1078
+ const firewall = el._firewall;
1079
+ if (firewall && el._pendingValue !== NOT_PENDING) {
1080
+ return !firewall._inFlight && !(firewall._statusFlags & STATUS_PENDING);
1081
+ }
1082
+ if (el._overrideValue !== void 0 && el._overrideValue !== NOT_PENDING) {
920
1083
  if (comp._statusFlags & STATUS_PENDING && !(comp._statusFlags & STATUS_UNINITIALIZED))
921
1084
  return true;
922
1085
  if (el._parentSource) {
@@ -925,6 +1088,9 @@ function computePendingState(el) {
925
1088
  }
926
1089
  return true;
927
1090
  }
1091
+ if (el._overrideValue !== void 0 && el._overrideValue === NOT_PENDING && !el._parentSource) {
1092
+ return false;
1093
+ }
928
1094
  if (el._pendingValue !== NOT_PENDING && !(comp._statusFlags & STATUS_UNINITIALIZED)) return true;
929
1095
  return !!(comp._statusFlags & STATUS_PENDING && !(comp._statusFlags & STATUS_UNINITIALIZED));
930
1096
  }
@@ -1011,7 +1177,7 @@ Object.assign(
1011
1177
  { DELETE }
1012
1178
  );
1013
1179
 
1014
- // ../../node_modules/.pnpm/@solidjs+web@2.0.0-beta.2_@solidjs+signals@0.12.0_solid-js@2.0.0-beta.2/node_modules/@solidjs/web/dist/dev.js
1180
+ // ../../node_modules/.pnpm/@solidjs+web@2.0.0-beta.4_@solidjs+signals@0.13.6_solid-js@2.0.0-beta.4/node_modules/@solidjs/web/dist/dev.js
1015
1181
  var effect = (fn, effectFn, initial) => createRenderEffect(fn, effectFn, initial, {
1016
1182
  transparent: true
1017
1183
  });