@slimlib/store 2.2.4 → 2.2.5

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
@@ -692,10 +692,8 @@ const effect = (callback, eager = 0 ) => {
692
692
  clearSources(node);
693
693
  }
694
694
  };
695
-
696
- if (effectScope) {
697
- effectScope[trackSymbol](dispose);
698
- }
695
+ const effects = effectScope?.[trackSymbol];
696
+ const effectIndex = effects ? effects.push(dispose) - 1 : -1;
699
697
 
700
698
 
701
699
 
@@ -719,6 +717,8 @@ const effect = (callback, eager = 0 ) => {
719
717
  runner();
720
718
  }
721
719
  catch (error) {
720
+ if (!disposed && effects)
721
+ effects[effectIndex] = undefined;
722
722
  dispose();
723
723
  throw error;
724
724
  }
@@ -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.5",
4
4
  "name": "@slimlib/store",
5
5
  "description": "Simple Proxy-based store for SPA",
6
6
  "license": "MIT",