@solidjs/signals 0.10.2 → 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
@@ -876,7 +876,9 @@ function runDisposal(node, zombie) {
876
876
  zombie ? (node._pendingDisposal = null) : (node._disposal = null);
877
877
  }
878
878
  function getNextChildId(owner) {
879
- 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++);
880
882
  throw new Error("Cannot get child id from owner without an id");
881
883
  }
882
884
  function formatId(prefix, id) {
@@ -900,8 +902,12 @@ function onCleanup(fn) {
900
902
  }
901
903
  function createOwner(options) {
902
904
  const parent = context;
905
+ const transparent = options?.transparent ?? false;
903
906
  const owner = {
904
- 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,
905
911
  _root: true,
906
912
  _parentComputed: parent?._root ? parent._parentComputed : parent,
907
913
  _firstChild: null,
@@ -1135,8 +1141,12 @@ function updateIfNecessary(el) {
1135
1141
  el._flags = REACTIVE_NONE;
1136
1142
  }
1137
1143
  function computed(fn, initialValue, options) {
1144
+ const transparent = options?.transparent ?? false;
1138
1145
  const self = {
1139
- 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,
1140
1150
  _equals: options?.equals != null ? options.equals : isEqual,
1141
1151
  _pureWrite: !!options?.pureWrite,
1142
1152
  _unobserved: options?.unobserved,