@signal-tree/vue 15.1.2 → 15.1.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 (2) hide show
  1. package/README.md +34 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -60,3 +60,37 @@ Validation stops at explicit `leaf(...)`, marker definitions, arrays and built-i
60
60
  terminal values. Their contents remain data, not separately owned tree locations.
61
61
  Ordinary functions remain valid callable data. These checks apply to initial
62
62
  construction, not arbitrary later writes or foreign reactivity from other libraries.
63
+
64
+ ## Ownership and disposal
65
+
66
+ `signalTree()` constructs a tree; it does not register scope cleanup. A tree owns
67
+ runtime resources until `destroy()` is called. Dropping its last reference is not
68
+ prompt resource reclamation.
69
+
70
+ For a component- or composable-owned tree, construct it inside the active Vue
71
+ scope and register its disposal there:
72
+
73
+ ```ts
74
+ import { onScopeDispose } from 'vue';
75
+ import { signalTree } from '@signal-tree/vue';
76
+
77
+ // Call synchronously during setup() or inside an active effectScope().
78
+ function useCounter() {
79
+ const tree = signalTree({ count: 0 });
80
+ onScopeDispose(() => tree.destroy());
81
+ return tree;
82
+ }
83
+ ```
84
+
85
+ Stopping the owning scope destroys the tree. A component that receives a tree
86
+ through props or `inject()` only borrows it: do not register destruction in that
87
+ consumer's scope. Shared application stores belong to the application owner,
88
+ which can use ordinary `provide()`/`inject()` to distribute them and call
89
+ `destroy()` after unmounting the application.
90
+
91
+ For SSR, construct a fresh tree for each request, provide it to that request's
92
+ application, and destroy it in `finally` after awaited rendering finishes. Do not
93
+ rely on component unmount hooks for request cleanup or share a module-level tree
94
+ between requests. With streaming rendering, wait for completion or abort before
95
+ destroying the request owner. Construct the client tree from the same initial
96
+ state used for the server output before hydration.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signal-tree/vue",
3
- "version": "15.1.2",
3
+ "version": "15.1.3",
4
4
  "description": "Vue observation for SignalTree.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -25,7 +25,7 @@
25
25
  "llms.txt"
26
26
  ],
27
27
  "dependencies": {
28
- "@signal-tree/kernel": "15.1.2"
28
+ "@signal-tree/kernel": "15.1.3"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "tslib": "^2.0.0",