@solidjs/signals 0.10.1 → 0.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dev.js CHANGED
@@ -858,6 +858,7 @@ function disposeChildren(node, self = false, zombie) {
858
858
  } else {
859
859
  node._firstChild = null;
860
860
  node._nextSibling = null;
861
+ node._childCount = 0;
861
862
  }
862
863
  runDisposal(node, zombie);
863
864
  }
@@ -875,7 +876,9 @@ function runDisposal(node, zombie) {
875
876
  zombie ? (node._pendingDisposal = null) : (node._disposal = null);
876
877
  }
877
878
  function getNextChildId(owner) {
878
- if (owner.id != null) return formatId(owner.id, owner._childCount++);
879
+ let counter = owner;
880
+ while (counter._transparent && counter._parent) counter = counter._parent;
881
+ if (counter.id != null) return formatId(counter.id, counter._childCount++);
879
882
  throw new Error("Cannot get child id from owner without an id");
880
883
  }
881
884
  function formatId(prefix, id) {
@@ -899,8 +902,12 @@ function onCleanup(fn) {
899
902
  }
900
903
  function createOwner(options) {
901
904
  const parent = context;
905
+ const transparent = options?.transparent ?? false;
902
906
  const owner = {
903
- id: options?.id ?? (parent?.id != null ? getNextChildId(parent) : undefined),
907
+ id:
908
+ options?.id ??
909
+ (transparent ? parent?.id : parent?.id != null ? getNextChildId(parent) : undefined),
910
+ _transparent: transparent || undefined,
904
911
  _root: true,
905
912
  _parentComputed: parent?._root ? parent._parentComputed : parent,
906
913
  _firstChild: null,
@@ -1019,6 +1026,7 @@ function recompute(el, create = false) {
1019
1026
  el._pendingFirstChild = el._firstChild;
1020
1027
  el._disposal = null;
1021
1028
  el._firstChild = null;
1029
+ el._childCount = 0;
1022
1030
  }
1023
1031
  }
1024
1032
  const isOptimisticDirty = !!(el._flags & REACTIVE_OPTIMISTIC_DIRTY);
@@ -1133,8 +1141,12 @@ function updateIfNecessary(el) {
1133
1141
  el._flags = REACTIVE_NONE;
1134
1142
  }
1135
1143
  function computed(fn, initialValue, options) {
1144
+ const transparent = options?.transparent ?? false;
1136
1145
  const self = {
1137
- id: options?.id ?? (context?.id != null ? getNextChildId(context) : undefined),
1146
+ id:
1147
+ options?.id ??
1148
+ (transparent ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
1149
+ _transparent: transparent || undefined,
1138
1150
  _equals: options?.equals != null ? options.equals : isEqual,
1139
1151
  _pureWrite: !!options?.pureWrite,
1140
1152
  _unobserved: options?.unobserved,