@slimlib/store 2.2.2 → 2.2.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.
Files changed (3) hide show
  1. package/README.md +2 -0
  2. package/index.mjs +8 -5
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -17,6 +17,8 @@ It also works really well with imperative code because the state primitive is Pr
17
17
 
18
18
  [Changelog](./CHANGELOG.md)
19
19
 
20
+ [Known effect GC and lifetime limitation](./TECH-DEBT.md#effect-garbage-collection-and-the-documented-lifetime-contract)
21
+
20
22
  ## Installation
21
23
 
22
24
  ```bash
package/index.mjs CHANGED
@@ -633,14 +633,17 @@ const effect = (callback, eager = 0 ) => {
633
633
  const effectId = node.f;
634
634
  const dispose = () => {
635
635
 
636
- disposed = true;
636
+ if (!disposed) {
637
637
 
638
- unregisterEffect(gcToken);
638
+ disposed = true;
639
+
640
+ unregisterEffect(gcToken);
639
641
 
640
- if (typeof node.l === 'function') {
641
- node.l();
642
+ if (typeof node.l === 'function') {
643
+ node.l();
644
+ }
645
+ clearSources(node);
642
646
  }
643
- clearSources(node);
644
647
  };
645
648
 
646
649
  if (effectScope) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "type": "module",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "name": "@slimlib/store",
5
5
  "description": "Simple Proxy-based store for SPA",
6
6
  "license": "MIT",