@slimlib/store 2.2.4 → 2.2.6

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.
Files changed (2) hide show
  1. package/index.mjs +5 -5
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -681,6 +681,8 @@ const effect = (callback, eager = 0 ) => {
681
681
  const dispose = () => {
682
682
 
683
683
  if (!disposed) {
684
+ if (effects)
685
+ effects[effectIndex] = undefined;
684
686
 
685
687
  disposed = true;
686
688
 
@@ -692,10 +694,8 @@ const effect = (callback, eager = 0 ) => {
692
694
  clearSources(node);
693
695
  }
694
696
  };
695
-
696
- if (effectScope) {
697
- effectScope[trackSymbol](dispose);
698
- }
697
+ const effects = effectScope?.[trackSymbol];
698
+ const effectIndex = effects ? effects.push(dispose) - 1 : -1;
699
699
 
700
700
 
701
701
 
@@ -777,7 +777,7 @@ const scope = (callback, parent = activeScope) => {
777
777
  return ctx;
778
778
  });
779
779
 
780
- ctx[trackSymbol] = (dispose) => effects.push(dispose);
780
+ ctx[trackSymbol] = effects;
781
781
  ctx[childrenSymbol] = children;
782
782
  ctx[parentSymbol] = parent;
783
783
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "type": "module",
3
- "version": "2.2.4",
3
+ "version": "2.2.6",
4
4
  "name": "@slimlib/store",
5
5
  "description": "Simple Proxy-based store for SPA",
6
6
  "license": "MIT",