@solidjs/signals 0.4.5 → 0.4.7

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
@@ -292,6 +292,8 @@ function cloneGraph(node) {
292
292
  _sources: node._sources ? [...node._sources] : null,
293
293
  _cloned: node
294
294
  });
295
+ if (clone._compute)
296
+ clone._stateFlags |= UNINITIALIZED_BIT;
295
297
  ActiveTransition._sources.set(node, clone);
296
298
  node._transition = ActiveTransition;
297
299
  if (node._sources) {
@@ -384,10 +386,12 @@ function finishTransition(transition2) {
384
386
  continue;
385
387
  if (clone._sources)
386
388
  replaceSourceObservers(clone, transition2);
387
- source.dispose(false);
388
- source.emptyDisposal();
389
- Object.assign(source, clone);
390
- delete source._cloned;
389
+ if (!(clone._stateFlags & UNINITIALIZED_BIT)) {
390
+ source.dispose(false);
391
+ source.emptyDisposal();
392
+ Object.assign(source, clone);
393
+ delete source._cloned;
394
+ }
391
395
  delete source._transition;
392
396
  }
393
397
  globalQueue._queues[0].push.apply(globalQueue._queues[0], transition2._queues[0]);
@@ -1044,6 +1048,7 @@ var Effect = class extends Computation {
1044
1048
  this._onerror = void 0;
1045
1049
  this._cleanup?.();
1046
1050
  this._cleanup = void 0;
1051
+ this._queue.notify(this, ERROR_BIT | LOADING_BIT, 0);
1047
1052
  super._disposeNode();
1048
1053
  }
1049
1054
  _run(type) {
@@ -1917,7 +1922,7 @@ function createOptimistic(initial, compute2, key) {
1917
1922
  if (!ActiveTransition)
1918
1923
  throw new Error("createOptimistic can only be updated inside a transition");
1919
1924
  ActiveTransition.addOptimistic(reset2);
1920
- queueMicrotask(() => node.write(v));
1925
+ queueMicrotask(() => reset2._transition && node.write(v));
1921
1926
  };
1922
1927
  var write = write2;
1923
1928
  const node = new Computation(initial, null);
@@ -1948,7 +1953,7 @@ function createOptimistic(initial, compute2, key) {
1948
1953
  throw new Error("createOptimistic can only be updated inside a transition");
1949
1954
  ActiveTransition.addOptimistic(reset);
1950
1955
  queueMicrotask(
1951
- () => setStore((s) => {
1956
+ () => reset._transition && setStore((s) => {
1952
1957
  lastChange = typeof v === "function" ? v(lastChange) : v;
1953
1958
  compute2(s.value, lastChange);
1954
1959
  })