@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.
package/build/dev.cjs CHANGED
@@ -14,7 +14,7 @@ var __export = (target, all) => {
14
14
  __defProp(target, name, { get: all[name], enumerable: true });
15
15
  };
16
16
 
17
- // ../../node_modules/.pnpm/@solidjs+signals@0.12.0/node_modules/@solidjs/signals/dist/dev.js
17
+ // ../../node_modules/.pnpm/@solidjs+signals@0.13.6/node_modules/@solidjs/signals/dist/dev.js
18
18
  function actualInsertIntoHeap(n, heap) {
19
19
  const parentHeight = (n._parent?._root ? n._parent._parentComputed?._height : n._parent?._height) ?? -1;
20
20
  if (parentHeight >= n._height) n._height = parentHeight + 1;
@@ -97,6 +97,65 @@ function runLaneEffects(type) {
97
97
  }
98
98
  }
99
99
  }
100
+ function queueStashedOptimisticEffects(node) {
101
+ for (let s = node._subs; s !== null; s = s._nextSub) {
102
+ const sub = s._sub;
103
+ if (!sub._type) continue;
104
+ if (sub._type === EFFECT_TRACKED) {
105
+ if (!sub._modified) {
106
+ sub._modified = true;
107
+ sub._queue.enqueue(EFFECT_USER, sub._run);
108
+ }
109
+ continue;
110
+ }
111
+ const queue = sub._flags & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
112
+ if (queue._min > sub._height) queue._min = sub._height;
113
+ insertIntoHeap(sub, queue);
114
+ }
115
+ }
116
+ function mergeTransitionState(target, outgoing) {
117
+ outgoing._done = target;
118
+ target._actions.push(...outgoing._actions);
119
+ for (const lane of activeLanes) {
120
+ if (lane._transition === outgoing) lane._transition = target;
121
+ }
122
+ target._optimisticNodes.push(...outgoing._optimisticNodes);
123
+ for (const store of outgoing._optimisticStores) target._optimisticStores.add(store);
124
+ for (const node of outgoing._asyncNodes) {
125
+ if (!target._asyncNodes.includes(node)) target._asyncNodes.push(node);
126
+ }
127
+ }
128
+ function resolveOptimisticNodes(nodes) {
129
+ for (let i = 0; i < nodes.length; i++) {
130
+ const node = nodes[i];
131
+ node._optimisticLane = void 0;
132
+ if (node._pendingValue !== NOT_PENDING) {
133
+ node._value = node._pendingValue;
134
+ node._pendingValue = NOT_PENDING;
135
+ }
136
+ const prevOverride = node._overrideValue;
137
+ node._overrideValue = NOT_PENDING;
138
+ if (prevOverride !== NOT_PENDING && node._value !== prevOverride) insertSubs(node, true);
139
+ node._transition = null;
140
+ }
141
+ nodes.length = 0;
142
+ }
143
+ function cleanupCompletedLanes(completingTransition) {
144
+ for (const lane of activeLanes) {
145
+ const owned = completingTransition ? lane._transition === completingTransition : !lane._transition;
146
+ if (!owned) continue;
147
+ if (!lane._mergedInto) {
148
+ if (lane._effectQueues[0].length) runQueue(lane._effectQueues[0], EFFECT_RENDER);
149
+ if (lane._effectQueues[1].length) runQueue(lane._effectQueues[1], EFFECT_USER);
150
+ }
151
+ if (lane._source._optimisticLane === lane) lane._source._optimisticLane = void 0;
152
+ lane._pendingAsync.clear();
153
+ lane._effectQueues[0].length = 0;
154
+ lane._effectQueues[1].length = 0;
155
+ activeLanes.delete(lane);
156
+ signalLanes.delete(lane._source);
157
+ }
158
+ }
100
159
  function schedule() {
101
160
  if (scheduled) return;
102
161
  scheduled = true;
@@ -130,36 +189,30 @@ function insertSubs(node, optimistic = false) {
130
189
  insertIntoHeap(s._sub, queue);
131
190
  }
132
191
  }
192
+ function commitPendingNodes() {
193
+ const pendingNodes = globalQueue._pendingNodes;
194
+ for (let i = 0; i < pendingNodes.length; i++) {
195
+ const n = pendingNodes[i];
196
+ if (n._pendingValue !== NOT_PENDING) {
197
+ n._value = n._pendingValue;
198
+ n._pendingValue = NOT_PENDING;
199
+ if (n._type && n._type !== EFFECT_TRACKED) n._modified = true;
200
+ }
201
+ if (!(n._statusFlags & STATUS_PENDING)) n._statusFlags &= ~STATUS_UNINITIALIZED;
202
+ if (n._fn) GlobalQueue._dispose(n, false, true);
203
+ }
204
+ pendingNodes.length = 0;
205
+ }
133
206
  function finalizePureQueue(completingTransition = null, incomplete = false) {
134
- let resolvePending = !incomplete;
207
+ const resolvePending = !incomplete;
208
+ if (resolvePending) commitPendingNodes();
135
209
  if (!incomplete) checkBoundaryChildren(globalQueue);
136
210
  if (dirtyQueue._max >= dirtyQueue._min) runHeap(dirtyQueue, GlobalQueue._update);
137
211
  if (resolvePending) {
138
- const pendingNodes = globalQueue._pendingNodes;
139
- for (let i = 0; i < pendingNodes.length; i++) {
140
- const n = pendingNodes[i];
141
- if (n._pendingValue !== NOT_PENDING) {
142
- n._value = n._pendingValue;
143
- n._pendingValue = NOT_PENDING;
144
- if (n._type && n._type !== EFFECT_TRACKED) n._modified = true;
145
- }
146
- if (!(n._statusFlags & STATUS_PENDING)) n._statusFlags &= ~STATUS_UNINITIALIZED;
147
- if (n._fn) GlobalQueue._dispose(n, false, true);
148
- }
149
- pendingNodes.length = 0;
150
- const optimisticNodes = completingTransition ? completingTransition._optimisticNodes : globalQueue._optimisticNodes;
151
- for (let i = 0; i < optimisticNodes.length; i++) {
152
- const n = optimisticNodes[i];
153
- const original = n._pendingValue;
154
- n._optimisticLane = void 0;
155
- if (original !== NOT_PENDING && n._value !== original) {
156
- n._value = original;
157
- insertSubs(n, true);
158
- }
159
- n._pendingValue = NOT_PENDING;
160
- n._transition = null;
161
- }
162
- optimisticNodes.length = 0;
212
+ commitPendingNodes();
213
+ resolveOptimisticNodes(
214
+ completingTransition ? completingTransition._optimisticNodes : globalQueue._optimisticNodes
215
+ );
163
216
  const optimisticStores = completingTransition ? completingTransition._optimisticStores : globalQueue._optimisticStores;
164
217
  if (GlobalQueue._clearOptimisticStore && optimisticStores.size) {
165
218
  for (const store of optimisticStores) {
@@ -168,20 +221,7 @@ function finalizePureQueue(completingTransition = null, incomplete = false) {
168
221
  optimisticStores.clear();
169
222
  schedule();
170
223
  }
171
- for (const lane of activeLanes) {
172
- const owned = completingTransition ? lane._transition === completingTransition : !lane._transition;
173
- if (!owned) continue;
174
- if (!lane._mergedInto) {
175
- if (lane._effectQueues[0].length) runQueue(lane._effectQueues[0], EFFECT_RENDER);
176
- if (lane._effectQueues[1].length) runQueue(lane._effectQueues[1], EFFECT_USER);
177
- }
178
- if (lane._source._optimisticLane === lane) lane._source._optimisticLane = void 0;
179
- lane._pendingAsync.clear();
180
- lane._effectQueues[0].length = 0;
181
- lane._effectQueues[1].length = 0;
182
- activeLanes.delete(lane);
183
- signalLanes.delete(lane._source);
184
- }
224
+ cleanupCompletedLanes(completingTransition);
185
225
  }
186
226
  }
187
227
  function checkBoundaryChildren(queue) {
@@ -196,8 +236,16 @@ function reassignPendingTransition(pendingNodes) {
196
236
  }
197
237
  }
198
238
  function flush() {
239
+ if (globalQueue._running) {
240
+ if (inTrackedQueueCallback) {
241
+ throw new Error(
242
+ "Cannot call flush() from inside onSettled or createTrackedEffect. flush() is not reentrant there."
243
+ );
244
+ }
245
+ return;
246
+ }
199
247
  let count = 0;
200
- while (scheduled) {
248
+ while (scheduled || activeTransition) {
201
249
  if (++count === 1e5) throw new Error("Potential Infinite Loop Detected.");
202
250
  globalQueue.flush();
203
251
  }
@@ -216,6 +264,15 @@ function transitionComplete(transition) {
216
264
  break;
217
265
  }
218
266
  }
267
+ if (done) {
268
+ for (let i = 0; i < transition._optimisticNodes.length; i++) {
269
+ const node = transition._optimisticNodes[i];
270
+ if (hasActiveOverride(node) && "_statusFlags" in node && node._statusFlags & STATUS_PENDING && node._error instanceof NotReadyError && node._error.source !== node) {
271
+ done = false;
272
+ break;
273
+ }
274
+ }
275
+ }
219
276
  done && (transition._done = true);
220
277
  return done;
221
278
  }
@@ -249,7 +306,7 @@ function getOrCreateLane(signal) {
249
306
  };
250
307
  signalLanes.set(signal, lane);
251
308
  activeLanes.add(lane);
252
- signal._laneVersion = signal._overrideVersion || 0;
309
+ signal._overrideSinceLane = false;
253
310
  return lane;
254
311
  }
255
312
  function findLane(lane) {
@@ -274,8 +331,11 @@ function resolveLane(el) {
274
331
  el._optimisticLane = void 0;
275
332
  return void 0;
276
333
  }
334
+ function resolveTransition(el) {
335
+ return resolveLane(el)?._transition ?? el._transition;
336
+ }
277
337
  function hasActiveOverride(el) {
278
- return !!(el._optimistic && el._pendingValue !== NOT_PENDING);
338
+ return !!(el._overrideValue !== void 0 && el._overrideValue !== NOT_PENDING);
279
339
  }
280
340
  function assignOrMergeLane(el, sourceLane) {
281
341
  const sourceRoot = findLane(sourceLane);
@@ -298,6 +358,96 @@ function assignOrMergeLane(el, sourceLane) {
298
358
  }
299
359
  el._optimisticLane = sourceLane;
300
360
  }
361
+ function addPendingSource(el, source) {
362
+ if (el._pendingSource === source || el._pendingSources?.has(source)) return false;
363
+ if (!el._pendingSource) {
364
+ el._pendingSource = source;
365
+ return true;
366
+ }
367
+ if (!el._pendingSources) {
368
+ el._pendingSources = /* @__PURE__ */ new Set([el._pendingSource, source]);
369
+ } else {
370
+ el._pendingSources.add(source);
371
+ }
372
+ el._pendingSource = void 0;
373
+ return true;
374
+ }
375
+ function removePendingSource(el, source) {
376
+ if (el._pendingSource) {
377
+ if (el._pendingSource !== source) return false;
378
+ el._pendingSource = void 0;
379
+ return true;
380
+ }
381
+ if (!el._pendingSources?.delete(source)) return false;
382
+ if (el._pendingSources.size === 1) {
383
+ el._pendingSource = el._pendingSources.values().next().value;
384
+ el._pendingSources = void 0;
385
+ } else if (el._pendingSources.size === 0) {
386
+ el._pendingSources = void 0;
387
+ }
388
+ return true;
389
+ }
390
+ function clearPendingSources(el) {
391
+ el._pendingSource = void 0;
392
+ el._pendingSources?.clear();
393
+ el._pendingSources = void 0;
394
+ }
395
+ function setPendingError(el, source, error) {
396
+ if (!source) {
397
+ el._error = null;
398
+ return;
399
+ }
400
+ if (error instanceof NotReadyError && error.source === source) {
401
+ el._error = error;
402
+ return;
403
+ }
404
+ const current = el._error;
405
+ if (!(current instanceof NotReadyError) || current.source !== source) {
406
+ el._error = new NotReadyError(source);
407
+ }
408
+ }
409
+ function forEachDependent(el, fn) {
410
+ for (let s = el._subs; s !== null; s = s._nextSub) fn(s._sub);
411
+ for (let child = el._child; child !== null; child = child._nextChild) {
412
+ for (let s = child._subs; s !== null; s = s._nextSub) fn(s._sub);
413
+ }
414
+ }
415
+ function settlePendingSource(el) {
416
+ let scheduled2 = false;
417
+ const visited = /* @__PURE__ */ new Set();
418
+ const settle = (node) => {
419
+ if (visited.has(node) || !removePendingSource(node, el)) return;
420
+ visited.add(node);
421
+ node._time = clock;
422
+ const source = node._pendingSource ?? node._pendingSources?.values().next().value;
423
+ if (source) {
424
+ setPendingError(node, source);
425
+ updatePendingSignal(node);
426
+ } else {
427
+ node._statusFlags &= ~STATUS_PENDING;
428
+ setPendingError(node);
429
+ updatePendingSignal(node);
430
+ if (node._blocked) {
431
+ if (node._type === EFFECT_TRACKED) {
432
+ const tracked = node;
433
+ if (!tracked._modified) {
434
+ tracked._modified = true;
435
+ tracked._queue.enqueue(EFFECT_USER, tracked._run);
436
+ }
437
+ } else {
438
+ const queue = node._flags & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
439
+ if (queue._min > node._height) queue._min = node._height;
440
+ insertIntoHeap(node, queue);
441
+ }
442
+ scheduled2 = true;
443
+ }
444
+ node._blocked = false;
445
+ }
446
+ forEachDependent(node, settle);
447
+ };
448
+ forEachDependent(el, settle);
449
+ if (scheduled2) schedule();
450
+ }
301
451
  function handleAsync(el, result, setter) {
302
452
  const isObject = typeof result === "object" && result !== null;
303
453
  const iterator = isObject && untrack(() => result[Symbol.asyncIterator]);
@@ -310,21 +460,21 @@ function handleAsync(el, result, setter) {
310
460
  let syncValue;
311
461
  const handleError = (error) => {
312
462
  if (el._inFlight !== result) return;
313
- globalQueue.initTransition(el._transition);
463
+ globalQueue.initTransition(resolveTransition(el));
314
464
  notifyStatus(el, error instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, error);
315
465
  el._time = clock;
316
466
  };
317
467
  const asyncWrite = (value, then) => {
318
468
  if (el._inFlight !== result) return;
319
469
  if (el._flags & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
320
- globalQueue.initTransition(el._transition);
470
+ globalQueue.initTransition(resolveTransition(el));
321
471
  clearStatus(el);
322
472
  const lane = resolveLane(el);
323
473
  if (lane) lane._pendingAsync.delete(el);
324
- if (el._optimistic) {
325
- const hadOverride = el._pendingValue !== NOT_PENDING;
326
- if (el._fn) el._pendingValue = value;
327
- if (!hadOverride) {
474
+ if (el._overrideValue !== void 0) {
475
+ if (el._overrideValue !== void 0 && el._overrideValue !== NOT_PENDING)
476
+ el._pendingValue = value;
477
+ else {
328
478
  el._value = value;
329
479
  insertSubs(el);
330
480
  }
@@ -343,6 +493,7 @@ function handleAsync(el, result, setter) {
343
493
  } else {
344
494
  setSignal(el, () => value);
345
495
  }
496
+ settlePendingSource(el);
346
497
  schedule();
347
498
  flush();
348
499
  then?.();
@@ -362,7 +513,7 @@ function handleAsync(el, result, setter) {
362
513
  );
363
514
  isSync = false;
364
515
  if (!resolved) {
365
- globalQueue.initTransition(el._transition);
516
+ globalQueue.initTransition(resolveTransition(el));
366
517
  throw new NotReadyError(context);
367
518
  }
368
519
  }
@@ -396,41 +547,48 @@ function handleAsync(el, result, setter) {
396
547
  };
397
548
  const immediatelyDone = iterate();
398
549
  if (!hadSyncValue && !immediatelyDone) {
399
- globalQueue.initTransition(el._transition);
550
+ globalQueue.initTransition(resolveTransition(el));
400
551
  throw new NotReadyError(context);
401
552
  }
402
553
  }
403
554
  return syncValue;
404
555
  }
405
- function clearStatus(el) {
406
- el._statusFlags = el._statusFlags & STATUS_UNINITIALIZED;
407
- el._error = null;
556
+ function clearStatus(el, clearUninitialized = false) {
557
+ clearPendingSources(el);
558
+ el._blocked = false;
559
+ el._statusFlags = clearUninitialized ? 0 : el._statusFlags & STATUS_UNINITIALIZED;
560
+ setPendingError(el);
408
561
  updatePendingSignal(el);
409
562
  el._notifyStatus?.();
410
563
  }
411
564
  function notifyStatus(el, status, error, blockStatus, lane) {
412
565
  if (status === STATUS_ERROR && !(error instanceof StatusError) && !(error instanceof NotReadyError))
413
566
  error = new StatusError(el, error);
414
- const isSource = error instanceof NotReadyError && error.source === el;
415
- const isOptimisticBoundary = status === STATUS_PENDING && el._optimistic && !isSource;
567
+ const pendingSource = status === STATUS_PENDING && error instanceof NotReadyError ? error.source : void 0;
568
+ const isSource = pendingSource === el;
569
+ const isOptimisticBoundary = status === STATUS_PENDING && el._overrideValue !== void 0 && !isSource;
416
570
  const startsBlocking = isOptimisticBoundary && hasActiveOverride(el);
417
571
  if (!blockStatus) {
418
- el._statusFlags = status | (status !== STATUS_ERROR ? el._statusFlags & STATUS_UNINITIALIZED : 0);
419
- el._error = error;
572
+ if (status === STATUS_PENDING && pendingSource) {
573
+ addPendingSource(el, pendingSource);
574
+ el._statusFlags = STATUS_PENDING | el._statusFlags & STATUS_UNINITIALIZED;
575
+ setPendingError(el, pendingSource, error);
576
+ } else {
577
+ clearPendingSources(el);
578
+ el._statusFlags = status | (status !== STATUS_ERROR ? el._statusFlags & STATUS_UNINITIALIZED : 0);
579
+ el._error = error;
580
+ }
420
581
  updatePendingSignal(el);
421
582
  }
422
583
  if (lane && !blockStatus) {
423
584
  assignOrMergeLane(el, lane);
424
585
  }
425
- if (startsBlocking && activeTransition && error instanceof NotReadyError) {
426
- const source = error.source;
427
- if (!activeTransition._asyncNodes.includes(source)) {
428
- activeTransition._asyncNodes.push(source);
429
- }
430
- }
431
586
  const downstreamBlockStatus = blockStatus || startsBlocking;
432
587
  const downstreamLane = blockStatus || isOptimisticBoundary ? void 0 : lane;
433
588
  if (el._notifyStatus) {
589
+ if (blockStatus && status === STATUS_PENDING) {
590
+ return;
591
+ }
434
592
  if (downstreamBlockStatus) {
435
593
  el._notifyStatus(status, error);
436
594
  } else {
@@ -438,48 +596,13 @@ function notifyStatus(el, status, error, blockStatus, lane) {
438
596
  }
439
597
  return;
440
598
  }
441
- for (let s = el._subs; s !== null; s = s._nextSub) {
442
- s._sub._time = clock;
443
- if (s._sub._error !== error) {
444
- !s._sub._transition && globalQueue._pendingNodes.push(s._sub);
445
- notifyStatus(s._sub, status, error, downstreamBlockStatus, downstreamLane);
446
- }
447
- }
448
- for (let child = el._child; child !== null; child = child._nextChild) {
449
- for (let s = child._subs; s !== null; s = s._nextSub) {
450
- s._sub._time = clock;
451
- if (s._sub._error !== error) {
452
- !s._sub._transition && globalQueue._pendingNodes.push(s._sub);
453
- notifyStatus(s._sub, status, error, downstreamBlockStatus, downstreamLane);
454
- }
455
- }
456
- }
457
- }
458
- function unlinkSubs(link) {
459
- const dep = link._dep;
460
- const nextDep = link._nextDep;
461
- const nextSub = link._nextSub;
462
- const prevSub = link._prevSub;
463
- if (nextSub !== null) nextSub._prevSub = prevSub;
464
- else dep._subsTail = prevSub;
465
- if (prevSub !== null) prevSub._nextSub = nextSub;
466
- else {
467
- dep._subs = nextSub;
468
- if (nextSub === null) {
469
- dep._unobserved?.();
470
- dep._fn && !dep._preventAutoDisposal && !(dep._flags & REACTIVE_ZOMBIE) && unobserved(dep);
599
+ forEachDependent(el, (sub) => {
600
+ sub._time = clock;
601
+ if (status === STATUS_PENDING && pendingSource && sub._pendingSource !== pendingSource && !sub._pendingSources?.has(pendingSource) || status !== STATUS_PENDING && (sub._error !== error || sub._pendingSource || sub._pendingSources)) {
602
+ if (!downstreamBlockStatus && !sub._transition) globalQueue._pendingNodes.push(sub);
603
+ notifyStatus(sub, status, error, downstreamBlockStatus, downstreamLane);
471
604
  }
472
- }
473
- return nextDep;
474
- }
475
- function unobserved(el) {
476
- deleteFromHeap(el, el._flags & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
477
- let dep = el._deps;
478
- while (dep !== null) {
479
- dep = unlinkSubs(dep);
480
- }
481
- el._deps = null;
482
- disposeChildren(el, true);
605
+ });
483
606
  }
484
607
  function markDisposal(el) {
485
608
  let child = el._firstChild;
@@ -516,7 +639,6 @@ function disposeChildren(node, self = false, zombie) {
516
639
  node._pendingFirstChild = null;
517
640
  } else {
518
641
  node._firstChild = null;
519
- node._nextSibling = null;
520
642
  node._childCount = 0;
521
643
  }
522
644
  runDisposal(node, zombie);
@@ -534,6 +656,32 @@ function runDisposal(node, zombie) {
534
656
  }
535
657
  zombie ? node._pendingDisposal = null : node._disposal = null;
536
658
  }
659
+ function unlinkSubs(link) {
660
+ const dep = link._dep;
661
+ const nextDep = link._nextDep;
662
+ const nextSub = link._nextSub;
663
+ const prevSub = link._prevSub;
664
+ if (nextSub !== null) nextSub._prevSub = prevSub;
665
+ else dep._subsTail = prevSub;
666
+ if (prevSub !== null) prevSub._nextSub = nextSub;
667
+ else {
668
+ dep._subs = nextSub;
669
+ if (nextSub === null) {
670
+ dep._unobserved?.();
671
+ dep._fn && !dep._preventAutoDisposal && !(dep._flags & REACTIVE_ZOMBIE) && unobserved(dep);
672
+ }
673
+ }
674
+ return nextDep;
675
+ }
676
+ function unobserved(el) {
677
+ deleteFromHeap(el, el._flags & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
678
+ let dep = el._deps;
679
+ while (dep !== null) {
680
+ dep = unlinkSubs(dep);
681
+ }
682
+ el._deps = null;
683
+ disposeChildren(el, true);
684
+ }
537
685
  function recompute(el, create = false) {
538
686
  const isEffect = el._type;
539
687
  if (!create) {
@@ -551,7 +699,7 @@ function recompute(el, create = false) {
551
699
  }
552
700
  }
553
701
  const isOptimisticDirty = !!(el._flags & REACTIVE_OPTIMISTIC_DIRTY);
554
- const hasOverride = hasActiveOverride(el);
702
+ const hasOverride = el._overrideValue !== void 0 && el._overrideValue !== NOT_PENDING;
555
703
  const wasPending = !!(el._statusFlags & STATUS_PENDING);
556
704
  const oldcontext = context;
557
705
  context = el;
@@ -574,7 +722,7 @@ function recompute(el, create = false) {
574
722
  }
575
723
  try {
576
724
  value = handleAsync(el, el._fn(value));
577
- clearStatus(el);
725
+ clearStatus(el, create);
578
726
  const resolvedLane = resolveLane(el);
579
727
  if (resolvedLane) {
580
728
  resolvedLane._pendingAsync.delete(el);
@@ -589,6 +737,7 @@ function recompute(el, create = false) {
589
737
  updatePendingSignal(lane._source);
590
738
  }
591
739
  }
740
+ if (e instanceof NotReadyError) el._blocked = true;
592
741
  notifyStatus(
593
742
  el,
594
743
  e instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
@@ -612,21 +761,21 @@ function recompute(el, create = false) {
612
761
  if (depsTail !== null) depsTail._nextDep = null;
613
762
  else el._deps = null;
614
763
  }
615
- const compareValue = hasOverride ? el._value : el._pendingValue === NOT_PENDING ? el._value : el._pendingValue;
764
+ const compareValue = hasOverride ? el._overrideValue : el._pendingValue === NOT_PENDING ? el._value : el._pendingValue;
616
765
  const valueChanged = !el._equals || !el._equals(compareValue, value);
617
766
  if (valueChanged) {
618
- const prevVisible = hasOverride ? el._value : void 0;
619
- if (create || isEffect && activeTransition !== el._transition || isOptimisticDirty)
767
+ const prevVisible = hasOverride ? el._overrideValue : void 0;
768
+ if (create || isEffect && activeTransition !== el._transition || isOptimisticDirty) {
620
769
  el._value = value;
621
- else el._pendingValue = value;
622
- if (hasOverride && !isOptimisticDirty && wasPending) {
623
- const ov = el._overrideVersion || 0;
624
- const lv = el._laneVersion || 0;
625
- if (ov <= lv) el._value = value;
626
- }
627
- if (!hasOverride || isOptimisticDirty || el._value !== prevVisible) {
770
+ if (hasOverride && isOptimisticDirty) {
771
+ el._overrideValue = value;
772
+ el._pendingValue = value;
773
+ }
774
+ } else el._pendingValue = value;
775
+ if (hasOverride && !isOptimisticDirty && wasPending && !el._overrideSinceLane)
776
+ el._overrideValue = value;
777
+ if (!hasOverride || isOptimisticDirty || el._overrideValue !== prevVisible)
628
778
  insertSubs(el, isOptimisticDirty || hasOverride);
629
- }
630
779
  } else if (hasOverride) {
631
780
  el._pendingValue = value;
632
781
  } else if (el._height != oldHeight) {
@@ -636,16 +785,17 @@ function recompute(el, create = false) {
636
785
  }
637
786
  }
638
787
  currentOptimisticLane = prevLane;
639
- (!create || el._statusFlags & STATUS_PENDING) && !el._transition && !(activeTransition && el._optimistic) && globalQueue._pendingNodes.push(el);
788
+ (!create || el._statusFlags & STATUS_PENDING) && !el._transition && !(activeTransition && hasOverride) && globalQueue._pendingNodes.push(el);
640
789
  el._transition && isEffect && activeTransition !== el._transition && runInTransition(el._transition, () => recompute(el));
641
790
  }
642
791
  function untrack(fn, strictReadLabel) {
643
- if (!tracking && !strictRead && true) return fn();
792
+ if (!externalSourceConfig && !tracking && !strictRead && true) return fn();
644
793
  const prevTracking = tracking;
645
794
  const prevStrictRead = strictRead;
646
795
  tracking = false;
647
796
  strictRead = false;
648
797
  try {
798
+ if (externalSourceConfig) return externalSourceConfig.untrack(fn);
649
799
  return fn();
650
800
  } finally {
651
801
  tracking = prevTracking;
@@ -653,36 +803,33 @@ function untrack(fn, strictReadLabel) {
653
803
  }
654
804
  }
655
805
  function setSignal(el, v) {
656
- if (!el._pureWrite && !leafEffectActive && context && el._firewall !== context)
806
+ if (!el._pureWrite && !context?._childrenForbidden && context && el._firewall !== context)
657
807
  console.warn("A Signal was written to in an owned scope.");
658
808
  if (el._transition && activeTransition !== el._transition)
659
809
  globalQueue.initTransition(el._transition);
660
- const isOptimistic = el._optimistic && !projectionWriteActive;
661
- const currentValue = isOptimistic ? el._value : el._pendingValue === NOT_PENDING ? el._value : el._pendingValue;
810
+ const isOptimistic = el._overrideValue !== void 0 && !projectionWriteActive;
811
+ const hasOverride = el._overrideValue !== void 0 && el._overrideValue !== NOT_PENDING;
812
+ const currentValue = isOptimistic ? hasOverride ? el._overrideValue : el._value : el._pendingValue === NOT_PENDING ? el._value : el._pendingValue;
662
813
  if (typeof v === "function") v = v(currentValue);
663
814
  const valueChanged = !el._equals || !el._equals(currentValue, v) || !!(el._statusFlags & STATUS_UNINITIALIZED);
664
815
  if (!valueChanged) {
665
- if (isOptimistic && el._pendingValue !== NOT_PENDING && el._fn) {
816
+ if (isOptimistic && hasOverride && el._fn) {
666
817
  insertSubs(el, true);
667
818
  schedule();
668
819
  }
669
820
  return v;
670
821
  }
671
822
  if (isOptimistic) {
672
- const alreadyTracked = globalQueue._optimisticNodes.includes(el);
673
- if (el._transition && alreadyTracked) {
674
- globalQueue.initTransition(el._transition);
675
- }
676
- if (el._pendingValue === NOT_PENDING) {
823
+ const firstOverride = el._overrideValue === NOT_PENDING;
824
+ if (!firstOverride) globalQueue.initTransition(resolveTransition(el));
825
+ if (firstOverride) {
677
826
  el._pendingValue = el._value;
678
- }
679
- if (!alreadyTracked) {
680
827
  globalQueue._optimisticNodes.push(el);
681
828
  }
682
- el._overrideVersion = (el._overrideVersion || 0) + 1;
829
+ el._overrideSinceLane = true;
683
830
  const lane = getOrCreateLane(el);
684
831
  el._optimisticLane = lane;
685
- el._value = v;
832
+ el._overrideValue = v;
686
833
  } else {
687
834
  if (el._pendingValue === NOT_PENDING) globalQueue._pendingNodes.push(el);
688
835
  el._pendingValue = v;
@@ -698,7 +845,11 @@ function setSignal(el, v) {
698
845
  }
699
846
  function computePendingState(el) {
700
847
  const comp = el;
701
- if (el._optimistic && el._pendingValue !== NOT_PENDING) {
848
+ const firewall = el._firewall;
849
+ if (firewall && el._pendingValue !== NOT_PENDING) {
850
+ return !firewall._inFlight && !(firewall._statusFlags & STATUS_PENDING);
851
+ }
852
+ if (el._overrideValue !== void 0 && el._overrideValue !== NOT_PENDING) {
702
853
  if (comp._statusFlags & STATUS_PENDING && !(comp._statusFlags & STATUS_UNINITIALIZED))
703
854
  return true;
704
855
  if (el._parentSource) {
@@ -707,6 +858,9 @@ function computePendingState(el) {
707
858
  }
708
859
  return true;
709
860
  }
861
+ if (el._overrideValue !== void 0 && el._overrideValue === NOT_PENDING && !el._parentSource) {
862
+ return false;
863
+ }
710
864
  if (el._pendingValue !== NOT_PENDING && !(comp._statusFlags & STATUS_UNINITIALIZED)) return true;
711
865
  return !!(comp._statusFlags & STATUS_PENDING && !(comp._statusFlags & STATUS_UNINITIALIZED));
712
866
  }
@@ -783,9 +937,9 @@ function updatePath(current, args, i = 0) {
783
937
  current[part] = value;
784
938
  }
785
939
  }
786
- var NotReadyError, StatusError, REACTIVE_NONE, REACTIVE_CHECK, REACTIVE_DIRTY, REACTIVE_RECOMPUTING_DEPS, REACTIVE_IN_HEAP, REACTIVE_IN_HEAP_HEIGHT, REACTIVE_ZOMBIE, REACTIVE_DISPOSED, REACTIVE_OPTIMISTIC_DIRTY, REACTIVE_SNAPSHOT_STALE, STATUS_PENDING, STATUS_ERROR, STATUS_UNINITIALIZED, EFFECT_RENDER, EFFECT_USER, EFFECT_TRACKED, NOT_PENDING, transitions, dirtyQueue, zombieQueue, clock, activeTransition, scheduled, projectionWriteActive, _onUnhandledAsync, Queue, GlobalQueue, globalQueue, signalLanes, activeLanes, leafEffectActive, tracking, context, currentOptimisticLane, strictRead, DELETE;
940
+ var NotReadyError, StatusError, REACTIVE_NONE, REACTIVE_CHECK, REACTIVE_DIRTY, REACTIVE_RECOMPUTING_DEPS, REACTIVE_IN_HEAP, REACTIVE_IN_HEAP_HEIGHT, REACTIVE_ZOMBIE, REACTIVE_DISPOSED, REACTIVE_OPTIMISTIC_DIRTY, REACTIVE_SNAPSHOT_STALE, STATUS_PENDING, STATUS_ERROR, STATUS_UNINITIALIZED, EFFECT_RENDER, EFFECT_USER, EFFECT_TRACKED, NOT_PENDING, transitions, dirtyQueue, zombieQueue, clock, activeTransition, scheduled, projectionWriteActive, inTrackedQueueCallback, stashedOptimisticReads, Queue, GlobalQueue, globalQueue, signalLanes, activeLanes, externalSourceConfig, tracking, context, currentOptimisticLane, strictRead, DELETE;
787
941
  var init_dev = __esm({
788
- "../../node_modules/.pnpm/@solidjs+signals@0.12.0/node_modules/@solidjs/signals/dist/dev.js"() {
942
+ "../../node_modules/.pnpm/@solidjs+signals@0.13.6/node_modules/@solidjs/signals/dist/dev.js"() {
789
943
  NotReadyError = class extends Error {
790
944
  source;
791
945
  constructor(source) {
@@ -824,7 +978,8 @@ var init_dev = __esm({
824
978
  activeTransition = null;
825
979
  scheduled = false;
826
980
  projectionWriteActive = false;
827
- _onUnhandledAsync = null;
981
+ inTrackedQueueCallback = false;
982
+ stashedOptimisticReads = null;
828
983
  Queue = class {
829
984
  _parent = null;
830
985
  _queues = [[], []];
@@ -904,19 +1059,32 @@ var init_dev = __esm({
904
1059
  if (activeTransition) {
905
1060
  const isComplete = transitionComplete(activeTransition);
906
1061
  if (!isComplete) {
907
- let t = activeTransition;
1062
+ const stashedTransition = activeTransition;
908
1063
  runHeap(zombieQueue, _GlobalQueue._update);
909
1064
  this._pendingNodes = [];
910
1065
  this._optimisticNodes = [];
911
1066
  this._optimisticStores = /* @__PURE__ */ new Set();
912
1067
  runLaneEffects(EFFECT_RENDER);
913
1068
  runLaneEffects(EFFECT_USER);
914
- this.stashQueues(activeTransition._queueStash);
1069
+ this.stashQueues(stashedTransition._queueStash);
915
1070
  clock++;
916
1071
  scheduled = dirtyQueue._max >= dirtyQueue._min;
917
- reassignPendingTransition(activeTransition._pendingNodes);
1072
+ reassignPendingTransition(stashedTransition._pendingNodes);
918
1073
  activeTransition = null;
919
- finalizePureQueue(null, true);
1074
+ if (!stashedTransition._actions.length && stashedTransition._optimisticNodes.length) {
1075
+ stashedOptimisticReads = /* @__PURE__ */ new Set();
1076
+ for (let i = 0; i < stashedTransition._optimisticNodes.length; i++) {
1077
+ const node = stashedTransition._optimisticNodes[i];
1078
+ if (node._fn || node._pureWrite) continue;
1079
+ stashedOptimisticReads.add(node);
1080
+ queueStashedOptimisticEffects(node);
1081
+ }
1082
+ }
1083
+ try {
1084
+ finalizePureQueue(null, true);
1085
+ } finally {
1086
+ stashedOptimisticReads = null;
1087
+ }
920
1088
  return;
921
1089
  }
922
1090
  this._pendingNodes !== activeTransition._pendingNodes && this._pendingNodes.push(...activeTransition._pendingNodes);
@@ -942,14 +1110,14 @@ var init_dev = __esm({
942
1110
  }
943
1111
  notify(node, mask, flags, error) {
944
1112
  if (mask & STATUS_PENDING) {
945
- if (_onUnhandledAsync && flags & STATUS_PENDING) {
946
- _onUnhandledAsync();
947
- }
948
1113
  if (flags & STATUS_PENDING) {
949
1114
  const actualError = error !== void 0 ? error : node._error;
950
- if (activeTransition && actualError && !activeTransition._asyncNodes.includes(actualError.source)) {
951
- activeTransition._asyncNodes.push(actualError.source);
952
- schedule();
1115
+ if (activeTransition && actualError) {
1116
+ const source = actualError.source;
1117
+ if (!activeTransition._asyncNodes.includes(source)) {
1118
+ activeTransition._asyncNodes.push(source);
1119
+ schedule();
1120
+ }
953
1121
  }
954
1122
  }
955
1123
  return true;
@@ -973,43 +1141,41 @@ var init_dev = __esm({
973
1141
  };
974
1142
  } else if (transition) {
975
1143
  const outgoing = activeTransition;
976
- outgoing._done = transition;
977
- transition._actions.push(...outgoing._actions);
978
- for (const lane of activeLanes) {
979
- if (lane._transition === outgoing) lane._transition = transition;
980
- }
981
- transition._optimisticNodes.push(...outgoing._optimisticNodes);
982
- for (const store of outgoing._optimisticStores) {
983
- transition._optimisticStores.add(store);
984
- }
1144
+ mergeTransitionState(transition, outgoing);
985
1145
  transitions.delete(outgoing);
986
1146
  activeTransition = transition;
987
1147
  }
988
1148
  transitions.add(activeTransition);
989
1149
  activeTransition._time = clock;
990
- for (let i = 0; i < this._pendingNodes.length; i++) {
991
- const n = this._pendingNodes[i];
992
- n._transition = activeTransition;
993
- activeTransition._pendingNodes.push(n);
1150
+ if (this._pendingNodes !== activeTransition._pendingNodes) {
1151
+ for (let i = 0; i < this._pendingNodes.length; i++) {
1152
+ const node = this._pendingNodes[i];
1153
+ node._transition = activeTransition;
1154
+ activeTransition._pendingNodes.push(node);
1155
+ }
1156
+ this._pendingNodes = activeTransition._pendingNodes;
994
1157
  }
995
- this._pendingNodes = activeTransition._pendingNodes;
996
- for (let i = 0; i < this._optimisticNodes.length; i++) {
997
- const node = this._optimisticNodes[i];
998
- node._transition = activeTransition;
999
- activeTransition._optimisticNodes.push(node);
1158
+ if (this._optimisticNodes !== activeTransition._optimisticNodes) {
1159
+ for (let i = 0; i < this._optimisticNodes.length; i++) {
1160
+ const node = this._optimisticNodes[i];
1161
+ node._transition = activeTransition;
1162
+ activeTransition._optimisticNodes.push(node);
1163
+ }
1164
+ this._optimisticNodes = activeTransition._optimisticNodes;
1000
1165
  }
1001
- this._optimisticNodes = activeTransition._optimisticNodes;
1002
1166
  for (const lane of activeLanes) {
1003
1167
  if (!lane._transition) lane._transition = activeTransition;
1004
1168
  }
1005
- for (const store of this._optimisticStores) activeTransition._optimisticStores.add(store);
1006
- this._optimisticStores = activeTransition._optimisticStores;
1169
+ if (this._optimisticStores !== activeTransition._optimisticStores) {
1170
+ for (const store of this._optimisticStores) activeTransition._optimisticStores.add(store);
1171
+ this._optimisticStores = activeTransition._optimisticStores;
1172
+ }
1007
1173
  }
1008
1174
  };
1009
1175
  globalQueue = new GlobalQueue();
1010
1176
  signalLanes = /* @__PURE__ */ new WeakMap();
1011
1177
  activeLanes = /* @__PURE__ */ new Set();
1012
- leafEffectActive = false;
1178
+ externalSourceConfig = null;
1013
1179
  GlobalQueue._update = recompute;
1014
1180
  GlobalQueue._dispose = disposeChildren;
1015
1181
  tracking = false;
@@ -1073,7 +1239,7 @@ function isHydrating(node) {
1073
1239
  }
1074
1240
  var effect, isServer, isDev;
1075
1241
  var init_dev2 = __esm({
1076
- "../../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"() {
1242
+ "../../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"() {
1077
1243
  init_dev();
1078
1244
  effect = (fn, effectFn, initial) => solidJs.createRenderEffect(fn, effectFn, initial, {
1079
1245
  transparent: true
@@ -1128,9 +1294,18 @@ function SolidQueryDevtools(props) {
1128
1294
  solidJs.createEffect(() => props.theme, (theme) => {
1129
1295
  devtools.setTheme(theme || "system");
1130
1296
  });
1131
- solidJs.onSettled(() => {
1297
+ let isMounted = false;
1298
+ let isDisposed = false;
1299
+ queueMicrotask(() => {
1300
+ if (isDisposed) return;
1132
1301
  devtools.mount(ref2);
1133
- solidJs.onCleanup(() => devtools.unmount());
1302
+ isMounted = true;
1303
+ });
1304
+ solidJs.onCleanup(() => {
1305
+ isDisposed = true;
1306
+ if (isMounted) {
1307
+ devtools.unmount();
1308
+ }
1134
1309
  });
1135
1310
  return (() => {
1136
1311
  var _el$ = _tmpl$();
@@ -1191,9 +1366,18 @@ function SolidQueryDevtoolsPanel(props) {
1191
1366
  solidJs.createEffect(() => props.theme, (theme) => {
1192
1367
  devtools.setTheme(theme || "system");
1193
1368
  });
1194
- solidJs.onSettled(() => {
1369
+ let isMounted = false;
1370
+ let isDisposed = false;
1371
+ queueMicrotask(() => {
1372
+ if (isDisposed) return;
1195
1373
  devtools.mount(ref2);
1196
- solidJs.onCleanup(() => devtools.unmount());
1374
+ isMounted = true;
1375
+ });
1376
+ solidJs.onCleanup(() => {
1377
+ isDisposed = true;
1378
+ if (isMounted) {
1379
+ devtools.unmount();
1380
+ }
1197
1381
  });
1198
1382
  return (() => {
1199
1383
  var _el$ = _tmpl$2();