@signal-tree/react 15.0.0-rc.14 → 15.0.0-rc.16
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/README.md +9 -3
- package/dist/use-signal-tree.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -50,6 +50,13 @@ const state = useSignalTree(tree, ($) => $());
|
|
|
50
50
|
|
|
51
51
|
Use whole-root projection only when the component needs whole-root truth.
|
|
52
52
|
|
|
53
|
+
## Server Rendering
|
|
54
|
+
|
|
55
|
+
`useSignalTree()` reads the same canonical selector snapshot during server
|
|
56
|
+
rendering, so React SSR does not require a mirrored store or a separate server
|
|
57
|
+
adapter. Hydration should construct the tree from the same application state
|
|
58
|
+
used by the server render before mounting the client tree.
|
|
59
|
+
|
|
53
60
|
## Selector Contract
|
|
54
61
|
|
|
55
62
|
Selectors read synchronously from the supplied root location and must return an
|
|
@@ -82,6 +89,5 @@ SignalTree remains the only state authority. This package owns subscription,
|
|
|
82
89
|
cleanup, and React snapshot observation. It does not mirror state, expose write
|
|
83
90
|
APIs, own the tree lifecycle, or change SignalTree's causal semantics.
|
|
84
91
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
of the initial surface.
|
|
92
|
+
React Native validation, custom equality, shared cross-component subscriptions,
|
|
93
|
+
and first-party memoized selectors are not part of the initial surface.
|
package/dist/use-signal-tree.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useCallback,useSyncExternalStore}from"react";import{observeOwnerInvalidation}from"@signal-tree/kernel/adapter";function useSignalTree(owner,selector){const subscribe=useCallback(notify=>observeOwnerInvalidation(owner,notify),[owner]);const getSnapshot=useCallback(()=>selector(owner.$),[owner,selector]);return useSyncExternalStore(subscribe,getSnapshot)}export{useSignalTree};
|
|
1
|
+
import{useCallback,useSyncExternalStore}from"react";import{observeOwnerInvalidation}from"@signal-tree/kernel/adapter";function useSignalTree(owner,selector){const subscribe=useCallback(notify=>observeOwnerInvalidation(owner,notify),[owner]);const getSnapshot=useCallback(()=>selector(owner.$),[owner,selector]);return useSyncExternalStore(subscribe,getSnapshot,getSnapshot)}export{useSignalTree};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signal-tree/react",
|
|
3
|
-
"version": "15.0.0-rc.
|
|
3
|
+
"version": "15.0.0-rc.16",
|
|
4
4
|
"description": "React 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.0.0-rc.
|
|
28
|
+
"@signal-tree/kernel": "15.0.0-rc.16"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"react": "^18.0.0 || ^19.0.0",
|