solid-js 1.6.15 → 1.7.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dev.cjs CHANGED
@@ -154,7 +154,10 @@ let Listener = null;
154
154
  let Updates = null;
155
155
  let Effects = null;
156
156
  let ExecCount = 0;
157
- let rootCount = 0;
157
+ const DevHooks = {
158
+ afterUpdate: null,
159
+ afterCreateOwner: null
160
+ };
158
161
  const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
159
162
  function createRoot(fn, detachedOwner) {
160
163
  const listener = Listener,
@@ -174,10 +177,7 @@ function createRoot(fn, detachedOwner) {
174
177
  updateFn = unowned ? () => fn(() => {
175
178
  throw new Error("Dispose method must be an explicit argument to createRoot function");
176
179
  }) : () => fn(() => untrack(() => cleanNode(root)));
177
- {
178
- if (owner) root.name = `${owner.name}-r${rootCount++}`;
179
- globalThis._$afterCreateRoot && globalThis._$afterCreateRoot(root);
180
- }
180
+ DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(root);
181
181
  Owner = root;
182
182
  Listener = null;
183
183
  try {
@@ -195,7 +195,10 @@ function createSignal(value, options) {
195
195
  observerSlots: null,
196
196
  comparator: options.equals || undefined
197
197
  };
198
- if (!options.internal) s.name = registerGraph(options.name || hashValue(value), s);
198
+ if (!options.internal) {
199
+ if (options.name) s.name = options.name;
200
+ registerGraph(s);
201
+ }
199
202
  const setter = value => {
200
203
  if (typeof value === "function") {
201
204
  if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);else value = value(s.value);
@@ -458,6 +461,20 @@ function onCleanup(fn) {
458
461
  if (Owner === null) console.warn("cleanups created outside a `createRoot` or `render` will never be run");else if (Owner.cleanups === null) Owner.cleanups = [fn];else Owner.cleanups.push(fn);
459
462
  return fn;
460
463
  }
464
+ function catchError(fn, handler) {
465
+ ERROR || (ERROR = Symbol("error"));
466
+ Owner = createComputation(undefined, undefined, true);
467
+ Owner.context = {
468
+ [ERROR]: [handler]
469
+ };
470
+ try {
471
+ return fn();
472
+ } catch (err) {
473
+ handleError(err);
474
+ } finally {
475
+ Owner = Owner.owner;
476
+ }
477
+ }
461
478
  function onError(fn) {
462
479
  ERROR || (ERROR = Symbol("error"));
463
480
  if (Owner === null) console.warn("error handlers created outside a `createRoot` or `render` will never be run");else if (Owner.context === null) Owner.context = {
@@ -532,49 +549,15 @@ function devComponent(Comp, props) {
532
549
  c.props = props;
533
550
  c.observers = null;
534
551
  c.observerSlots = null;
535
- c.componentName = Comp.name;
552
+ c.name = Comp.name;
553
+ c.component = Comp;
536
554
  updateComputation(c);
537
555
  return c.tValue !== undefined ? c.tValue : c.value;
538
556
  }
539
- function hashValue(v) {
540
- const s = new Set();
541
- return `s${typeof v === "string" ? hash(v) : hash(untrack(() => JSON.stringify(v, (k, v) => {
542
- if (typeof v === "object" && v != null) {
543
- if (s.has(v)) return;
544
- s.add(v);
545
- const keys = Object.keys(v);
546
- const desc = Object.getOwnPropertyDescriptors(v);
547
- const newDesc = keys.reduce((memo, key) => {
548
- const value = desc[key];
549
- if (!value.get) memo[key] = value;
550
- return memo;
551
- }, {});
552
- v = Object.create({}, newDesc);
553
- }
554
- if (typeof v === "bigint") {
555
- return `${v.toString()}n`;
556
- }
557
- return v;
558
- }) || ""))}`;
559
- }
560
- function registerGraph(name, value) {
561
- let tryName = name;
562
- if (Owner) {
563
- let i = 0;
564
- Owner.sourceMap || (Owner.sourceMap = {});
565
- while (Owner.sourceMap[tryName]) tryName = `${name}-${++i}`;
566
- Owner.sourceMap[tryName] = value;
567
- value.graph = Owner;
568
- }
569
- return tryName;
570
- }
571
- function serializeGraph(owner) {
572
- owner || (owner = Owner);
573
- if (!owner) return {};
574
- return {
575
- ...serializeValues(owner.sourceMap),
576
- ...(owner.owned ? serializeChildren(owner) : {})
577
- };
557
+ function registerGraph(value) {
558
+ if (!Owner) return;
559
+ if (Owner.sourceMap) Owner.sourceMap.push(value);else Owner.sourceMap = [value];
560
+ value.graph = Owner;
578
561
  }
579
562
  function createContext(defaultValue, options) {
580
563
  const id = Symbol("context");
@@ -758,8 +741,8 @@ function createComputation(fn, init, pure, state = STALE, options) {
758
741
  } else {
759
742
  if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
760
743
  }
761
- c.name = options && options.name || `${Owner.name || "c"}-${(Owner.owned || Owner.tOwned).length}`;
762
744
  }
745
+ if (options && options.name) c.name = options.name;
763
746
  if (ExternalSourceFactory) {
764
747
  const [track, trigger] = createSignal(undefined, {
765
748
  equals: false
@@ -773,6 +756,7 @@ function createComputation(fn, init, pure, state = STALE, options) {
773
756
  return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
774
757
  };
775
758
  }
759
+ DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(c);
776
760
  return c;
777
761
  }
778
762
  function runTop(node) {
@@ -862,7 +846,7 @@ function completeUpdates(wait) {
862
846
  }
863
847
  const e = Effects;
864
848
  Effects = null;
865
- if (e.length) runUpdates(() => runEffects(e), false);else globalThis._$afterUpdate && globalThis._$afterUpdate();
849
+ if (e.length) runUpdates(() => runEffects(e), false);else DevHooks.afterUpdate && DevHooks.afterUpdate();
866
850
  if (res) res();
867
851
  }
868
852
  function runQueue(queue) {
@@ -938,16 +922,16 @@ function cleanNode(node) {
938
922
  }
939
923
  if (Transition && Transition.running && node.pure) {
940
924
  if (node.tOwned) {
941
- for (i = 0; i < node.tOwned.length; i++) cleanNode(node.tOwned[i]);
925
+ for (i = node.tOwned.length - 1; i >= 0; i--) cleanNode(node.tOwned[i]);
942
926
  delete node.tOwned;
943
927
  }
944
928
  reset(node, true);
945
929
  } else if (node.owned) {
946
- for (i = 0; i < node.owned.length; i++) cleanNode(node.owned[i]);
930
+ for (i = node.owned.length - 1; i >= 0; i--) cleanNode(node.owned[i]);
947
931
  node.owned = null;
948
932
  }
949
933
  if (node.cleanups) {
950
- for (i = 0; i < node.cleanups.length; i++) node.cleanups[i]();
934
+ for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
951
935
  node.cleanups = null;
952
936
  }
953
937
  if (Transition && Transition.running) node.tState = 0;else node.state = 0;
@@ -964,22 +948,24 @@ function reset(node, top) {
964
948
  }
965
949
  }
966
950
  function castError(err) {
967
- if (err instanceof Error || typeof err === "string") return err;
968
- return new Error("Unknown error");
951
+ if (err instanceof Error) return err;
952
+ return new Error(typeof err === "string" ? err : "Unknown error", {
953
+ cause: err
954
+ });
969
955
  }
970
956
  function runErrors(fns, err) {
971
957
  for (const f of fns) f(err);
972
958
  }
973
959
  function handleError(err) {
974
- err = castError(err);
975
960
  const fns = ERROR && lookup(Owner, ERROR);
976
961
  if (!fns) throw err;
962
+ const error = castError(err);
977
963
  if (Effects) Effects.push({
978
964
  fn() {
979
- runErrors(fns, err);
965
+ runErrors(fns, error);
980
966
  },
981
967
  state: STALE
982
- });else runErrors(fns, err);
968
+ });else runErrors(fns, error);
983
969
  }
984
970
  function lookup(owner, key) {
985
971
  return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
@@ -1008,30 +994,6 @@ function createProvider(id, options) {
1008
994
  return res;
1009
995
  };
1010
996
  }
1011
- function hash(s) {
1012
- for (var i = 0, h = 9; i < s.length;) h = Math.imul(h ^ s.charCodeAt(i++), 9 ** 9);
1013
- return `${h ^ h >>> 9}`;
1014
- }
1015
- function serializeValues(sources = {}) {
1016
- const k = Object.keys(sources);
1017
- const result = {};
1018
- for (let i = 0; i < k.length; i++) {
1019
- const key = k[i];
1020
- result[key] = sources[key].value;
1021
- }
1022
- return result;
1023
- }
1024
- function serializeChildren(root) {
1025
- const result = {};
1026
- for (let i = 0, len = root.owned.length; i < len; i++) {
1027
- const node = root.owned[i];
1028
- result[node.componentName ? `${node.componentName}:${node.name}` : node.name] = {
1029
- ...serializeValues(node.sourceMap),
1030
- ...(node.owned ? serializeChildren(node) : {})
1031
- };
1032
- }
1033
- return result;
1034
- }
1035
997
 
1036
998
  function observable(input) {
1037
999
  return {
@@ -1451,10 +1413,9 @@ function Index(props) {
1451
1413
  }) ;
1452
1414
  }
1453
1415
  function Show(props) {
1454
- let strictEqual = false;
1455
1416
  const keyed = props.keyed;
1456
1417
  const condition = createMemo(() => props.when, undefined, {
1457
- equals: (a, b) => strictEqual ? a === b : !a === !b,
1418
+ equals: (a, b) => keyed ? a === b : !a === !b,
1458
1419
  name: "condition"
1459
1420
  } );
1460
1421
  return createMemo(() => {
@@ -1462,8 +1423,10 @@ function Show(props) {
1462
1423
  if (c) {
1463
1424
  const child = props.children;
1464
1425
  const fn = typeof child === "function" && child.length > 0;
1465
- strictEqual = keyed || fn;
1466
- return fn ? untrack(() => child(c)) : child;
1426
+ return fn ? untrack(() => child(keyed ? c : () => {
1427
+ if (true && !untrack(condition)) console.warn("Accessing stale value from Show.");
1428
+ return props.when;
1429
+ })) : child;
1467
1430
  }
1468
1431
  return props.fallback;
1469
1432
  }, undefined, {
@@ -1471,9 +1434,8 @@ function Show(props) {
1471
1434
  } );
1472
1435
  }
1473
1436
  function Switch(props) {
1474
- let strictEqual = false;
1475
1437
  let keyed = false;
1476
- const equals = (a, b) => a[0] === b[0] && (strictEqual ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
1438
+ const equals = (a, b) => a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
1477
1439
  const conditions = children(() => props.children),
1478
1440
  evalConditions = createMemo(() => {
1479
1441
  let conds = conditions();
@@ -1495,8 +1457,10 @@ function Switch(props) {
1495
1457
  if (index < 0) return props.fallback;
1496
1458
  const c = cond.children;
1497
1459
  const fn = typeof c === "function" && c.length > 0;
1498
- strictEqual = keyed || fn;
1499
- return fn ? untrack(() => c(when)) : c;
1460
+ return fn ? untrack(() => c(keyed ? when : () => {
1461
+ if (true && untrack(evalConditions)[0] !== index) console.warn("Accessing stale value from Match.");
1462
+ return cond.when;
1463
+ })) : c;
1500
1464
  }, undefined, {
1501
1465
  name: "value"
1502
1466
  } );
@@ -1523,12 +1487,9 @@ function ErrorBoundary(props) {
1523
1487
  if (e = errored()) {
1524
1488
  const f = props.fallback;
1525
1489
  if ((typeof f !== "function" || f.length == 0)) console.error(e);
1526
- const res = typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
1527
- onError(setErrored);
1528
- return res;
1490
+ return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
1529
1491
  }
1530
- onError(setErrored);
1531
- return props.children;
1492
+ return catchError(() => props.children, setErrored);
1532
1493
  }, undefined, {
1533
1494
  name: "value"
1534
1495
  } );
@@ -1701,14 +1662,11 @@ function Suspense(props) {
1701
1662
  }
1702
1663
 
1703
1664
  exports.DEV = void 0;
1704
- {
1705
- exports.DEV = {
1706
- writeSignal,
1707
- serializeGraph,
1708
- registerGraph,
1709
- hashValue
1710
- };
1711
- }
1665
+ exports.DEV = {
1666
+ hooks: DevHooks,
1667
+ writeSignal,
1668
+ registerGraph
1669
+ };
1712
1670
  if (globalThis) {
1713
1671
  if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
1714
1672
  }
@@ -1726,6 +1684,7 @@ exports.SuspenseList = SuspenseList;
1726
1684
  exports.Switch = Switch;
1727
1685
  exports.batch = batch;
1728
1686
  exports.cancelCallback = cancelCallback;
1687
+ exports.catchError = catchError;
1729
1688
  exports.children = children;
1730
1689
  exports.createComponent = createComponent;
1731
1690
  exports.createComputed = createComputed;
package/dist/dev.js CHANGED
@@ -152,7 +152,10 @@ let Listener = null;
152
152
  let Updates = null;
153
153
  let Effects = null;
154
154
  let ExecCount = 0;
155
- let rootCount = 0;
155
+ const DevHooks = {
156
+ afterUpdate: null,
157
+ afterCreateOwner: null
158
+ };
156
159
  const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
157
160
  function createRoot(fn, detachedOwner) {
158
161
  const listener = Listener,
@@ -172,10 +175,7 @@ function createRoot(fn, detachedOwner) {
172
175
  updateFn = unowned ? () => fn(() => {
173
176
  throw new Error("Dispose method must be an explicit argument to createRoot function");
174
177
  }) : () => fn(() => untrack(() => cleanNode(root)));
175
- {
176
- if (owner) root.name = `${owner.name}-r${rootCount++}`;
177
- globalThis._$afterCreateRoot && globalThis._$afterCreateRoot(root);
178
- }
178
+ DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(root);
179
179
  Owner = root;
180
180
  Listener = null;
181
181
  try {
@@ -193,7 +193,10 @@ function createSignal(value, options) {
193
193
  observerSlots: null,
194
194
  comparator: options.equals || undefined
195
195
  };
196
- if (!options.internal) s.name = registerGraph(options.name || hashValue(value), s);
196
+ if (!options.internal) {
197
+ if (options.name) s.name = options.name;
198
+ registerGraph(s);
199
+ }
197
200
  const setter = value => {
198
201
  if (typeof value === "function") {
199
202
  if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);else value = value(s.value);
@@ -456,6 +459,20 @@ function onCleanup(fn) {
456
459
  if (Owner === null) console.warn("cleanups created outside a `createRoot` or `render` will never be run");else if (Owner.cleanups === null) Owner.cleanups = [fn];else Owner.cleanups.push(fn);
457
460
  return fn;
458
461
  }
462
+ function catchError(fn, handler) {
463
+ ERROR || (ERROR = Symbol("error"));
464
+ Owner = createComputation(undefined, undefined, true);
465
+ Owner.context = {
466
+ [ERROR]: [handler]
467
+ };
468
+ try {
469
+ return fn();
470
+ } catch (err) {
471
+ handleError(err);
472
+ } finally {
473
+ Owner = Owner.owner;
474
+ }
475
+ }
459
476
  function onError(fn) {
460
477
  ERROR || (ERROR = Symbol("error"));
461
478
  if (Owner === null) console.warn("error handlers created outside a `createRoot` or `render` will never be run");else if (Owner.context === null) Owner.context = {
@@ -530,49 +547,15 @@ function devComponent(Comp, props) {
530
547
  c.props = props;
531
548
  c.observers = null;
532
549
  c.observerSlots = null;
533
- c.componentName = Comp.name;
550
+ c.name = Comp.name;
551
+ c.component = Comp;
534
552
  updateComputation(c);
535
553
  return c.tValue !== undefined ? c.tValue : c.value;
536
554
  }
537
- function hashValue(v) {
538
- const s = new Set();
539
- return `s${typeof v === "string" ? hash(v) : hash(untrack(() => JSON.stringify(v, (k, v) => {
540
- if (typeof v === "object" && v != null) {
541
- if (s.has(v)) return;
542
- s.add(v);
543
- const keys = Object.keys(v);
544
- const desc = Object.getOwnPropertyDescriptors(v);
545
- const newDesc = keys.reduce((memo, key) => {
546
- const value = desc[key];
547
- if (!value.get) memo[key] = value;
548
- return memo;
549
- }, {});
550
- v = Object.create({}, newDesc);
551
- }
552
- if (typeof v === "bigint") {
553
- return `${v.toString()}n`;
554
- }
555
- return v;
556
- }) || ""))}`;
557
- }
558
- function registerGraph(name, value) {
559
- let tryName = name;
560
- if (Owner) {
561
- let i = 0;
562
- Owner.sourceMap || (Owner.sourceMap = {});
563
- while (Owner.sourceMap[tryName]) tryName = `${name}-${++i}`;
564
- Owner.sourceMap[tryName] = value;
565
- value.graph = Owner;
566
- }
567
- return tryName;
568
- }
569
- function serializeGraph(owner) {
570
- owner || (owner = Owner);
571
- if (!owner) return {};
572
- return {
573
- ...serializeValues(owner.sourceMap),
574
- ...(owner.owned ? serializeChildren(owner) : {})
575
- };
555
+ function registerGraph(value) {
556
+ if (!Owner) return;
557
+ if (Owner.sourceMap) Owner.sourceMap.push(value);else Owner.sourceMap = [value];
558
+ value.graph = Owner;
576
559
  }
577
560
  function createContext(defaultValue, options) {
578
561
  const id = Symbol("context");
@@ -756,8 +739,8 @@ function createComputation(fn, init, pure, state = STALE, options) {
756
739
  } else {
757
740
  if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
758
741
  }
759
- c.name = options && options.name || `${Owner.name || "c"}-${(Owner.owned || Owner.tOwned).length}`;
760
742
  }
743
+ if (options && options.name) c.name = options.name;
761
744
  if (ExternalSourceFactory) {
762
745
  const [track, trigger] = createSignal(undefined, {
763
746
  equals: false
@@ -771,6 +754,7 @@ function createComputation(fn, init, pure, state = STALE, options) {
771
754
  return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
772
755
  };
773
756
  }
757
+ DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(c);
774
758
  return c;
775
759
  }
776
760
  function runTop(node) {
@@ -860,7 +844,7 @@ function completeUpdates(wait) {
860
844
  }
861
845
  const e = Effects;
862
846
  Effects = null;
863
- if (e.length) runUpdates(() => runEffects(e), false);else globalThis._$afterUpdate && globalThis._$afterUpdate();
847
+ if (e.length) runUpdates(() => runEffects(e), false);else DevHooks.afterUpdate && DevHooks.afterUpdate();
864
848
  if (res) res();
865
849
  }
866
850
  function runQueue(queue) {
@@ -936,16 +920,16 @@ function cleanNode(node) {
936
920
  }
937
921
  if (Transition && Transition.running && node.pure) {
938
922
  if (node.tOwned) {
939
- for (i = 0; i < node.tOwned.length; i++) cleanNode(node.tOwned[i]);
923
+ for (i = node.tOwned.length - 1; i >= 0; i--) cleanNode(node.tOwned[i]);
940
924
  delete node.tOwned;
941
925
  }
942
926
  reset(node, true);
943
927
  } else if (node.owned) {
944
- for (i = 0; i < node.owned.length; i++) cleanNode(node.owned[i]);
928
+ for (i = node.owned.length - 1; i >= 0; i--) cleanNode(node.owned[i]);
945
929
  node.owned = null;
946
930
  }
947
931
  if (node.cleanups) {
948
- for (i = 0; i < node.cleanups.length; i++) node.cleanups[i]();
932
+ for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
949
933
  node.cleanups = null;
950
934
  }
951
935
  if (Transition && Transition.running) node.tState = 0;else node.state = 0;
@@ -962,22 +946,24 @@ function reset(node, top) {
962
946
  }
963
947
  }
964
948
  function castError(err) {
965
- if (err instanceof Error || typeof err === "string") return err;
966
- return new Error("Unknown error");
949
+ if (err instanceof Error) return err;
950
+ return new Error(typeof err === "string" ? err : "Unknown error", {
951
+ cause: err
952
+ });
967
953
  }
968
954
  function runErrors(fns, err) {
969
955
  for (const f of fns) f(err);
970
956
  }
971
957
  function handleError(err) {
972
- err = castError(err);
973
958
  const fns = ERROR && lookup(Owner, ERROR);
974
959
  if (!fns) throw err;
960
+ const error = castError(err);
975
961
  if (Effects) Effects.push({
976
962
  fn() {
977
- runErrors(fns, err);
963
+ runErrors(fns, error);
978
964
  },
979
965
  state: STALE
980
- });else runErrors(fns, err);
966
+ });else runErrors(fns, error);
981
967
  }
982
968
  function lookup(owner, key) {
983
969
  return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
@@ -1006,30 +992,6 @@ function createProvider(id, options) {
1006
992
  return res;
1007
993
  };
1008
994
  }
1009
- function hash(s) {
1010
- for (var i = 0, h = 9; i < s.length;) h = Math.imul(h ^ s.charCodeAt(i++), 9 ** 9);
1011
- return `${h ^ h >>> 9}`;
1012
- }
1013
- function serializeValues(sources = {}) {
1014
- const k = Object.keys(sources);
1015
- const result = {};
1016
- for (let i = 0; i < k.length; i++) {
1017
- const key = k[i];
1018
- result[key] = sources[key].value;
1019
- }
1020
- return result;
1021
- }
1022
- function serializeChildren(root) {
1023
- const result = {};
1024
- for (let i = 0, len = root.owned.length; i < len; i++) {
1025
- const node = root.owned[i];
1026
- result[node.componentName ? `${node.componentName}:${node.name}` : node.name] = {
1027
- ...serializeValues(node.sourceMap),
1028
- ...(node.owned ? serializeChildren(node) : {})
1029
- };
1030
- }
1031
- return result;
1032
- }
1033
995
 
1034
996
  function observable(input) {
1035
997
  return {
@@ -1449,10 +1411,9 @@ function Index(props) {
1449
1411
  }) ;
1450
1412
  }
1451
1413
  function Show(props) {
1452
- let strictEqual = false;
1453
1414
  const keyed = props.keyed;
1454
1415
  const condition = createMemo(() => props.when, undefined, {
1455
- equals: (a, b) => strictEqual ? a === b : !a === !b,
1416
+ equals: (a, b) => keyed ? a === b : !a === !b,
1456
1417
  name: "condition"
1457
1418
  } );
1458
1419
  return createMemo(() => {
@@ -1460,8 +1421,10 @@ function Show(props) {
1460
1421
  if (c) {
1461
1422
  const child = props.children;
1462
1423
  const fn = typeof child === "function" && child.length > 0;
1463
- strictEqual = keyed || fn;
1464
- return fn ? untrack(() => child(c)) : child;
1424
+ return fn ? untrack(() => child(keyed ? c : () => {
1425
+ if (true && !untrack(condition)) console.warn("Accessing stale value from Show.");
1426
+ return props.when;
1427
+ })) : child;
1465
1428
  }
1466
1429
  return props.fallback;
1467
1430
  }, undefined, {
@@ -1469,9 +1432,8 @@ function Show(props) {
1469
1432
  } );
1470
1433
  }
1471
1434
  function Switch(props) {
1472
- let strictEqual = false;
1473
1435
  let keyed = false;
1474
- const equals = (a, b) => a[0] === b[0] && (strictEqual ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
1436
+ const equals = (a, b) => a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
1475
1437
  const conditions = children(() => props.children),
1476
1438
  evalConditions = createMemo(() => {
1477
1439
  let conds = conditions();
@@ -1493,8 +1455,10 @@ function Switch(props) {
1493
1455
  if (index < 0) return props.fallback;
1494
1456
  const c = cond.children;
1495
1457
  const fn = typeof c === "function" && c.length > 0;
1496
- strictEqual = keyed || fn;
1497
- return fn ? untrack(() => c(when)) : c;
1458
+ return fn ? untrack(() => c(keyed ? when : () => {
1459
+ if (true && untrack(evalConditions)[0] !== index) console.warn("Accessing stale value from Match.");
1460
+ return cond.when;
1461
+ })) : c;
1498
1462
  }, undefined, {
1499
1463
  name: "value"
1500
1464
  } );
@@ -1521,12 +1485,9 @@ function ErrorBoundary(props) {
1521
1485
  if (e = errored()) {
1522
1486
  const f = props.fallback;
1523
1487
  if ((typeof f !== "function" || f.length == 0)) console.error(e);
1524
- const res = typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
1525
- onError(setErrored);
1526
- return res;
1488
+ return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
1527
1489
  }
1528
- onError(setErrored);
1529
- return props.children;
1490
+ return catchError(() => props.children, setErrored);
1530
1491
  }, undefined, {
1531
1492
  name: "value"
1532
1493
  } );
@@ -1699,16 +1660,13 @@ function Suspense(props) {
1699
1660
  }
1700
1661
 
1701
1662
  let DEV;
1702
- {
1703
- DEV = {
1704
- writeSignal,
1705
- serializeGraph,
1706
- registerGraph,
1707
- hashValue
1708
- };
1709
- }
1663
+ DEV = {
1664
+ hooks: DevHooks,
1665
+ writeSignal,
1666
+ registerGraph
1667
+ };
1710
1668
  if (globalThis) {
1711
1669
  if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
1712
1670
  }
1713
1671
 
1714
- export { $DEVCOMP, $PROXY, $TRACK, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, resetErrorBoundaries, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
1672
+ export { $DEVCOMP, $PROXY, $TRACK, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, catchError, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, resetErrorBoundaries, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };