raf-effect-atom 0.3.2 → 0.3.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.
- package/CHANGELOG.md +7 -1
- package/dist/use-atom-result.d.mts +6 -0
- package/dist/use-atom-result.mjs +7 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.3](https://github.com/KATT/raf-effect-atom/compare/raf-effect-atom%400.3.2...raf-effect-atom%400.3.3) (2026-10-24)
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* **raf-effect-atom:** name the fixes when useAtomResult throws for a browser-only handle on the server ([40b94d0](https://github.com/KATT/raf-effect-atom/commit/40b94d07947b65bb06d278cf47c855f4b8afdc78))
|
|
8
|
+
|
|
3
9
|
## [0.3.2](https://github.com/KATT/raf-effect-atom/compare/raf-effect-atom%400.3.1...raf-effect-atom%400.3.2) (2026-10-24)
|
|
4
10
|
|
|
5
11
|
### Bug Fixes
|
|
6
12
|
|
|
7
|
-
|
|
13
|
+
- **raf-effect-atom:** take no lease on an atom a mounted component reads ([899d0b7](https://github.com/KATT/raf-effect-atom/commit/899d0b7c70f6836c41c4416b0c2063c1ccf3d8b2))
|
|
8
14
|
|
|
9
15
|
## [0.3.1](https://github.com/KATT/raf-effect-atom/compare/raf-effect-atom%400.3.0...raf-effect-atom%400.3.1) (2026-10-24)
|
|
10
16
|
|
|
@@ -63,6 +63,12 @@ type Readable<S> = S extends ((...args: infer Args) => Atom.Atom<AsyncResult.Asy
|
|
|
63
63
|
* `RequestRegistry.make`), or a module-level registry would share results
|
|
64
64
|
* between requests: in development, the hook throws without one.
|
|
65
65
|
*
|
|
66
|
+
* On the server, the hook throws for a handle `Loader.prefetchInBrowser`
|
|
67
|
+
* returned, so React renders the nearest Suspense boundary's fallback and
|
|
68
|
+
* reports the error. With no boundary between the read and the route, the
|
|
69
|
+
* server can't render the page. `useHandleValue` returns `Initial` there
|
|
70
|
+
* instead.
|
|
71
|
+
*
|
|
66
72
|
* `Atom.transform`'s `initialValueTarget` option points at the end of the
|
|
67
73
|
* target's own chain, which for an AtomRpc query with `reactivityKeys` is an
|
|
68
74
|
* inner atom with no serialization key. A derived atom read here sets
|
package/dist/use-atom-result.mjs
CHANGED
|
@@ -87,6 +87,12 @@ const targetsOf = (atom, handle, hook) => {
|
|
|
87
87
|
* `RequestRegistry.make`), or a module-level registry would share results
|
|
88
88
|
* between requests: in development, the hook throws without one.
|
|
89
89
|
*
|
|
90
|
+
* On the server, the hook throws for a handle `Loader.prefetchInBrowser`
|
|
91
|
+
* returned, so React renders the nearest Suspense boundary's fallback and
|
|
92
|
+
* reports the error. With no boundary between the read and the route, the
|
|
93
|
+
* server can't render the page. `useHandleValue` returns `Initial` there
|
|
94
|
+
* instead.
|
|
95
|
+
*
|
|
90
96
|
* `Atom.transform`'s `initialValueTarget` option points at the end of the
|
|
91
97
|
* target's own chain, which for an AtomRpc query with `reactivityKeys` is an
|
|
92
98
|
* inner atom with no serialization key. A derived atom read here sets
|
|
@@ -115,7 +121,7 @@ const useAtomResult = (source, handle) => {
|
|
|
115
121
|
const registry = React.useContext(RegistryContext);
|
|
116
122
|
const atom = atomOf(source, handle.args);
|
|
117
123
|
requireRequestRegistry(registry, "useAtomResult");
|
|
118
|
-
if (handle.inBrowser === true && isRequestRegistry(registry)) throw new Error(`raf-effect-atom: ${String(atom)} starts in the browser (Loader.prefetchInBrowser), so the server renders the nearest Suspense boundary's fallback, and the browser renders the boundary.`);
|
|
124
|
+
if (handle.inBrowser === true && isRequestRegistry(registry)) throw new Error(`raf-effect-atom: ${String(atom)} starts in the browser (Loader.prefetchInBrowser), so useAtomResult throws on the server: React renders the nearest Suspense boundary's fallback, and the browser renders the boundary. Read it under a Suspense boundary inside the route, or with useHandleValue, which returns Initial on the server.`);
|
|
119
125
|
const targets = targetsOf(atom, handle, "useAtomResult");
|
|
120
126
|
const { read, started } = targets;
|
|
121
127
|
const streamed = Predicate.isString(targets.key) ? stream(registry, targets.key) : void 0;
|
package/package.json
CHANGED