@tanstack/query-devtools 5.0.0-alpha.88 → 5.0.0-beta.0

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,5 +1,8 @@
1
- // ../../node_modules/.pnpm/solid-js@1.6.13/node_modules/solid-js/dist/solid.js
2
- var sharedConfig = {};
1
+ // ../../node_modules/.pnpm/solid-js@1.7.8/node_modules/solid-js/dist/solid.js
2
+ var sharedConfig = {
3
+ context: void 0,
4
+ registry: void 0
5
+ };
3
6
  function setHydrateContext(context) {
4
7
  sharedConfig.context = context;
5
8
  }
@@ -84,7 +87,8 @@ function createEffect(fn, value, options) {
84
87
  const c = createComputation(fn, value, false, STALE), s = SuspenseContext && lookup(Owner, SuspenseContext.id);
85
88
  if (s)
86
89
  c.suspense = s;
87
- c.user = true;
90
+ if (!options || !options.render)
91
+ c.user = true;
88
92
  Effects ? Effects.push(c) : updateComputation(c);
89
93
  }
90
94
  function createMemo(fn, value, options) {
@@ -128,7 +132,7 @@ function createResource(pSource, pFetcher, pOptions) {
128
132
  function loadEnd(p, v, error2, key) {
129
133
  if (pr === p) {
130
134
  pr = null;
131
- resolved = true;
135
+ key !== void 0 && (resolved = true);
132
136
  if ((p === initP || v === initP) && options.onHydrated)
133
137
  queueMicrotask(() => options.onHydrated(key, {
134
138
  value: v
@@ -150,7 +154,7 @@ function createResource(pSource, pFetcher, pOptions) {
150
154
  runUpdates(() => {
151
155
  if (err === void 0)
152
156
  setValue(() => v);
153
- setState(err !== void 0 ? "errored" : "ready");
157
+ setState(err !== void 0 ? "errored" : resolved ? "ready" : "unresolved");
154
158
  setError(err);
155
159
  for (const c of contexts.keys())
156
160
  c.decrement();
@@ -337,8 +341,8 @@ function children(fn) {
337
341
  var SuspenseContext;
338
342
  function readSignal() {
339
343
  const runningTransition = Transition && Transition.running;
340
- if (this.sources && (!runningTransition && this.state || runningTransition && this.tState)) {
341
- if (!runningTransition && this.state === STALE || runningTransition && this.tState === STALE)
344
+ if (this.sources && (runningTransition ? this.tState : this.state)) {
345
+ if ((runningTransition ? this.tState : this.state) === STALE)
342
346
  updateComputation(this);
343
347
  else {
344
348
  const updates = Updates;
@@ -388,7 +392,7 @@ function writeSignal(node, value, isComp) {
388
392
  const TransitionRunning = Transition && Transition.running;
389
393
  if (TransitionRunning && Transition.disposed.has(o))
390
394
  continue;
391
- if (TransitionRunning && !o.tState || !TransitionRunning && !o.state) {
395
+ if (TransitionRunning ? !o.tState : !o.state) {
392
396
  if (o.pure)
393
397
  Updates.push(o);
394
398
  else
@@ -396,10 +400,10 @@ function writeSignal(node, value, isComp) {
396
400
  if (o.observers)
397
401
  markDownstream(o);
398
402
  }
399
- if (TransitionRunning)
400
- o.tState = STALE;
401
- else
403
+ if (!TransitionRunning)
402
404
  o.state = STALE;
405
+ else
406
+ o.tState = STALE;
403
407
  }
404
408
  if (Updates.length > 1e6) {
405
409
  Updates = [];
@@ -512,9 +516,9 @@ function createComputation(fn, init, pure, state = STALE, options) {
512
516
  }
513
517
  function runTop(node) {
514
518
  const runningTransition = Transition && Transition.running;
515
- if (!runningTransition && node.state === 0 || runningTransition && node.tState === 0)
519
+ if ((runningTransition ? node.tState : node.state) === 0)
516
520
  return;
517
- if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING)
521
+ if ((runningTransition ? node.tState : node.state) === PENDING)
518
522
  return lookUpstream(node);
519
523
  if (node.suspense && untrack(node.suspense.inFallback))
520
524
  return node.suspense.effects.push(node);
@@ -522,7 +526,7 @@ function runTop(node) {
522
526
  while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
523
527
  if (runningTransition && Transition.disposed.has(node))
524
528
  return;
525
- if (!runningTransition && node.state || runningTransition && node.tState)
529
+ if (runningTransition ? node.tState : node.state)
526
530
  ancestors.push(node);
527
531
  }
528
532
  for (let i = ancestors.length - 1; i >= 0; i--) {
@@ -534,9 +538,9 @@ function runTop(node) {
534
538
  return;
535
539
  }
536
540
  }
537
- if (!runningTransition && node.state === STALE || runningTransition && node.tState === STALE) {
541
+ if ((runningTransition ? node.tState : node.state) === STALE) {
538
542
  updateComputation(node);
539
- } else if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) {
543
+ } else if ((runningTransition ? node.tState : node.state) === PENDING) {
540
544
  const updates = Updates;
541
545
  Updates = null;
542
546
  runUpdates(() => lookUpstream(node, ancestors[0]), false);
@@ -650,8 +654,18 @@ function runUserEffects(queue) {
650
654
  else
651
655
  queue[userLength++] = e;
652
656
  }
653
- if (sharedConfig.context)
657
+ if (sharedConfig.context) {
658
+ if (sharedConfig.count) {
659
+ sharedConfig.effects || (sharedConfig.effects = []);
660
+ sharedConfig.effects.push(...queue.slice(0, userLength));
661
+ return;
662
+ } else if (sharedConfig.effects) {
663
+ queue = [...sharedConfig.effects, ...queue];
664
+ userLength += sharedConfig.effects.length;
665
+ delete sharedConfig.effects;
666
+ }
654
667
  setHydrateContext();
668
+ }
655
669
  for (i = 0; i < userLength; i++)
656
670
  runTop(queue[i]);
657
671
  }
@@ -664,10 +678,11 @@ function lookUpstream(node, ignore) {
664
678
  for (let i = 0; i < node.sources.length; i += 1) {
665
679
  const source = node.sources[i];
666
680
  if (source.sources) {
667
- if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE) {
681
+ const state = runningTransition ? source.tState : source.state;
682
+ if (state === STALE) {
668
683
  if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
669
684
  runTop(source);
670
- } else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING)
685
+ } else if (state === PENDING)
671
686
  lookUpstream(source, ignore);
672
687
  }
673
688
  }
@@ -676,7 +691,7 @@ function markDownstream(node) {
676
691
  const runningTransition = Transition && Transition.running;
677
692
  for (let i = 0; i < node.observers.length; i += 1) {
678
693
  const o = node.observers[i];
679
- if (!runningTransition && !o.state || runningTransition && !o.tState) {
694
+ if (runningTransition ? !o.tState : !o.state) {
680
695
  if (runningTransition)
681
696
  o.tState = PENDING;
682
697
  else
@@ -706,18 +721,18 @@ function cleanNode(node) {
706
721
  }
707
722
  if (Transition && Transition.running && node.pure) {
708
723
  if (node.tOwned) {
709
- for (i = 0; i < node.tOwned.length; i++)
724
+ for (i = node.tOwned.length - 1; i >= 0; i--)
710
725
  cleanNode(node.tOwned[i]);
711
726
  delete node.tOwned;
712
727
  }
713
728
  reset(node, true);
714
729
  } else if (node.owned) {
715
- for (i = 0; i < node.owned.length; i++)
730
+ for (i = node.owned.length - 1; i >= 0; i--)
716
731
  cleanNode(node.owned[i]);
717
732
  node.owned = null;
718
733
  }
719
734
  if (node.cleanups) {
720
- for (i = 0; i < node.cleanups.length; i++)
735
+ for (i = node.cleanups.length - 1; i >= 0; i--)
721
736
  node.cleanups[i]();
722
737
  node.cleanups = null;
723
738
  }
@@ -738,28 +753,34 @@ function reset(node, top) {
738
753
  }
739
754
  }
740
755
  function castError(err) {
741
- if (err instanceof Error || typeof err === "string")
756
+ if (err instanceof Error)
742
757
  return err;
743
- return new Error("Unknown error");
758
+ return new Error(typeof err === "string" ? err : "Unknown error", {
759
+ cause: err
760
+ });
744
761
  }
745
- function runErrors(fns, err) {
746
- for (const f of fns)
747
- f(err);
762
+ function runErrors(err, fns, owner) {
763
+ try {
764
+ for (const f of fns)
765
+ f(err);
766
+ } catch (e) {
767
+ handleError(e, owner && owner.owner || null);
768
+ }
748
769
  }
749
- function handleError(err) {
750
- err = castError(err);
751
- const fns = ERROR && lookup(Owner, ERROR);
770
+ function handleError(err, owner = Owner) {
771
+ const fns = ERROR && lookup(owner, ERROR);
772
+ const error = castError(err);
752
773
  if (!fns)
753
- throw err;
774
+ throw error;
754
775
  if (Effects)
755
776
  Effects.push({
756
777
  fn() {
757
- runErrors(fns, err);
778
+ runErrors(error, fns, owner);
758
779
  },
759
780
  state: STALE
760
781
  });
761
782
  else
762
- runErrors(fns, err);
783
+ runErrors(error, fns, owner);
763
784
  }
764
785
  function lookup(owner, key) {
765
786
  return owner ? owner.context && owner.context[key] !== void 0 ? owner.context[key] : lookup(owner.owner, key) : void 0;
@@ -946,8 +967,11 @@ function lazy(fn) {
946
967
  const ctx = sharedConfig.context;
947
968
  if (ctx) {
948
969
  const [s, set] = createSignal();
970
+ sharedConfig.count || (sharedConfig.count = 0);
971
+ sharedConfig.count++;
949
972
  (p || (p = fn())).then((mod) => {
950
973
  setHydrateContext(ctx);
974
+ sharedConfig.count--;
951
975
  set(() => mod.default);
952
976
  setHydrateContext();
953
977
  });
@@ -972,6 +996,7 @@ function lazy(fn) {
972
996
  wrap.preload = () => p || ((p = fn()).then((mod) => comp = () => mod.default), p);
973
997
  return wrap;
974
998
  }
999
+ var narrowedError = (name) => `Stale read from <${name}>.`;
975
1000
  function For(props) {
976
1001
  const fallback = "fallback" in props && {
977
1002
  fallback: () => props.fallback
@@ -985,26 +1010,27 @@ function Index(props) {
985
1010
  return createMemo(indexArray(() => props.each, props.children, fallback || void 0));
986
1011
  }
987
1012
  function Show(props) {
988
- let strictEqual = false;
989
1013
  const keyed = props.keyed;
990
1014
  const condition = createMemo(() => props.when, void 0, {
991
- equals: (a, b) => strictEqual ? a === b : !a === !b
1015
+ equals: (a, b) => keyed ? a === b : !a === !b
992
1016
  });
993
1017
  return createMemo(() => {
994
1018
  const c = condition();
995
1019
  if (c) {
996
1020
  const child = props.children;
997
1021
  const fn = typeof child === "function" && child.length > 0;
998
- strictEqual = keyed || fn;
999
- return fn ? untrack(() => child(c)) : child;
1022
+ return fn ? untrack(() => child(keyed ? c : () => {
1023
+ if (!untrack(condition))
1024
+ throw narrowedError("Show");
1025
+ return props.when;
1026
+ })) : child;
1000
1027
  }
1001
1028
  return props.fallback;
1002
1029
  }, void 0, void 0);
1003
1030
  }
1004
1031
  function Switch(props) {
1005
- let strictEqual = false;
1006
1032
  let keyed = false;
1007
- const equals = (a, b) => a[0] === b[0] && (strictEqual ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
1033
+ const equals = (a, b) => a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
1008
1034
  const conditions = children(() => props.children), evalConditions = createMemo(() => {
1009
1035
  let conds = conditions();
1010
1036
  if (!Array.isArray(conds))
@@ -1026,8 +1052,11 @@ function Switch(props) {
1026
1052
  return props.fallback;
1027
1053
  const c = cond.children;
1028
1054
  const fn = typeof c === "function" && c.length > 0;
1029
- strictEqual = keyed || fn;
1030
- return fn ? untrack(() => c(when)) : c;
1055
+ return fn ? untrack(() => c(keyed ? when : () => {
1056
+ if (untrack(evalConditions)[0] !== index)
1057
+ throw narrowedError("Match");
1058
+ return cond.when;
1059
+ })) : c;
1031
1060
  }, void 0, void 0);
1032
1061
  }
1033
1062
  function Match(props) {
@@ -1035,7 +1064,7 @@ function Match(props) {
1035
1064
  }
1036
1065
  var SuspenseListContext = createContext();
1037
1066
 
1038
- // ../../node_modules/.pnpm/solid-js@1.6.13/node_modules/solid-js/web/dist/web.js
1067
+ // ../../node_modules/.pnpm/solid-js@1.7.8/node_modules/solid-js/web/dist/web.js
1039
1068
  var booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
1040
1069
  var Properties = /* @__PURE__ */ new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
1041
1070
  function reconcileArrays(parentNode, a, b) {
@@ -1113,8 +1142,18 @@ function insert(parent, accessor, marker, initial) {
1113
1142
  createRenderEffect((current) => insertExpression(parent, accessor(), current, marker), initial);
1114
1143
  }
1115
1144
  function insertExpression(parent, value, current, marker, unwrapArray) {
1116
- if (sharedConfig.context && !current)
1117
- current = [...parent.childNodes];
1145
+ if (sharedConfig.context) {
1146
+ !current && (current = [...parent.childNodes]);
1147
+ let cleaned = [];
1148
+ for (let i = 0; i < current.length; i++) {
1149
+ const node = current[i];
1150
+ if (node.nodeType === 8 && node.data.slice(0, 2) === "!$")
1151
+ node.remove();
1152
+ else
1153
+ cleaned.push(node);
1154
+ }
1155
+ current = cleaned;
1156
+ }
1118
1157
  while (typeof current === "function")
1119
1158
  current = current();
1120
1159
  if (value === current)
@@ -1180,7 +1219,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
1180
1219
  appendNodes(parent, array);
1181
1220
  }
1182
1221
  current = array;
1183
- } else if (value instanceof Node) {
1222
+ } else if (value.nodeType) {
1184
1223
  if (sharedConfig.context && value.parentNode)
1185
1224
  return current = multi ? [value] : value;
1186
1225
  if (Array.isArray(current)) {
@@ -1199,14 +1238,14 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
1199
1238
  function normalizeIncomingArray(normalized, array, current, unwrap) {
1200
1239
  let dynamic = false;
1201
1240
  for (let i = 0, len = array.length; i < len; i++) {
1202
- let item = array[i], prev = current && current[i];
1203
- if (item instanceof Node) {
1204
- normalized.push(item);
1205
- } else if (item == null || item === true || item === false)
1241
+ let item = array[i], prev = current && current[i], t;
1242
+ if (item == null || item === true || item === false)
1206
1243
  ;
1207
- else if (Array.isArray(item)) {
1244
+ else if ((t = typeof item) === "object" && item.nodeType) {
1245
+ normalized.push(item);
1246
+ } else if (Array.isArray(item)) {
1208
1247
  dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
1209
- } else if (typeof item === "function") {
1248
+ } else if (t === "function") {
1210
1249
  if (unwrap) {
1211
1250
  while (typeof item === "function")
1212
1251
  item = item();
@@ -1217,13 +1256,9 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
1217
1256
  }
1218
1257
  } else {
1219
1258
  const value = String(item);
1220
- if (value === "<!>") {
1221
- if (prev && prev.nodeType === 8)
1222
- normalized.push(prev);
1223
- } else if (prev && prev.nodeType === 3) {
1224
- prev.data = value;
1259
+ if (prev && prev.nodeType === 3 && prev.data === value)
1225
1260
  normalized.push(prev);
1226
- } else
1261
+ else
1227
1262
  normalized.push(document.createTextNode(value));
1228
1263
  }
1229
1264
  }