@raf-query/react 0.1.17 → 0.2.1
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 +16 -2
- package/README.md +17 -17
- package/dist/client.mjs +13 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [0.1
|
|
3
|
+
## [0.2.1](https://github.com/KATT/raf-query/compare/0.2.0...0.2.1) (2026-10-13)
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* **tooling:** don't walk node_modules when copying StackBlitz examples ([#52](https://github.com/KATT/raf-query/issues/52)) ([1ab1f6a](https://github.com/KATT/raf-query/commit/1ab1f6a813118646b11dd4cb804bb030f02e775d))
|
|
8
|
+
|
|
9
|
+
## [0.2.0](https://github.com/KATT/raf-query/compare/0.1.16...0.2.0) (2026-10-13)
|
|
10
|
+
|
|
11
|
+
### ⚠ BREAKING CHANGES
|
|
12
|
+
|
|
13
|
+
- **react:** qc.fetch / qc.ensure reject with an AbortError when cancelled ([#47](https://github.com/KATT/raf-query/issues/47))
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
- **react:** qc.fetch / qc.ensure reject with an AbortError when cancelled ([#47](https://github.com/KATT/raf-query/issues/47)) ([53aa90b](https://github.com/KATT/raf-query/commit/53aa90b4b6068cff3998b189d3d563f338a3e564))
|
|
4
18
|
|
|
5
19
|
### Performance Improvements
|
|
6
20
|
|
|
7
|
-
|
|
21
|
+
- **react:** browser build of the TanStack Router integration ([#48](https://github.com/KATT/raf-query/issues/48)) ([75e78cf](https://github.com/KATT/raf-query/commit/75e78cf968c069188a2688ad3298fb4bee2e3b8c))
|
|
8
22
|
|
|
9
23
|
## [0.1.16](https://github.com/KATT/raf-query/compare/0.1.15...0.1.16) (2026-10-13)
|
|
10
24
|
|
package/README.md
CHANGED
|
@@ -751,23 +751,23 @@ When the last reader of a query unsubscribes during a background refetch, a `que
|
|
|
751
751
|
|
|
752
752
|
`@raf-query/core`:
|
|
753
753
|
|
|
754
|
-
| Export | Use
|
|
755
|
-
| ------------------------------------------------------------ |
|
|
756
|
-
| `QueryCache` | The cache service (`qc.effect`): `make`, `layer`, and the verbs as Effects
|
|
757
|
-
| `Query` | Cache entries: `Query.fetch`, `Query.changes`, `Query.getUnsafe`, `Query.metaUnsafe`, …
|
|
758
|
-
| `Platform` | The page the cache watches (focus, network); swap it in tests
|
|
759
|
-
| `queryOptions(options)` | Typed options for a query factory
|
|
760
|
-
| `infiniteQueryOptions(options)` | Typed options for a paged query factory
|
|
761
|
-
| `hashKey(key)`, `matchesKey(key, prefix)` | Key helpers
|
|
762
|
-
| `QueryObserver` | One reader's view of a query, with tracked results; for bindings
|
|
763
|
-
| `Query.CancelledError` | Failure of
|
|
764
|
-
| `RedactedError` | What a streamed pending query rejects with when its server request failed
|
|
765
|
-
| `QueryHandle<TFactory>` | Handle type for props
|
|
766
|
-
| `EnsuredQueryHandle<TFactory>` | Handle type for props fed by `ensure`
|
|
767
|
-
| `Thenable<T>` | Promise with `status` / `value` / `reason`, read by `use()`
|
|
768
|
-
| `DataOf<TFactory>`, `InputOf<TFactory>`, `ErrorOf<TFactory>` | A factory's data, input and error types
|
|
769
|
-
| `ServicesOf<TFactory>` | The services a factory's `queryFn` Effect needs; `never` for promises
|
|
770
|
-
| `Register`, `QueryMeta` | Augment `Register` with `queryMeta` to type [`meta`](#query-meta)
|
|
754
|
+
| Export | Use |
|
|
755
|
+
| ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
756
|
+
| `QueryCache` | The cache service (`qc.effect`): `make`, `layer`, and the verbs as Effects |
|
|
757
|
+
| `Query` | Cache entries: `Query.fetch`, `Query.changes`, `Query.getUnsafe`, `Query.metaUnsafe`, … |
|
|
758
|
+
| `Platform` | The page the cache watches (focus, network); swap it in tests |
|
|
759
|
+
| `queryOptions(options)` | Typed options for a query factory |
|
|
760
|
+
| `infiniteQueryOptions(options)` | Typed options for a paged query factory |
|
|
761
|
+
| `hashKey(key)`, `matchesKey(key, prefix)` | Key helpers |
|
|
762
|
+
| `QueryObserver` | One reader's view of a query, with tracked results; for bindings |
|
|
763
|
+
| `Query.CancelledError` | Failure of an Effect request whose entry was removed or cleared before it settled. `qc.fetch` / `qc.ensure` reject with an `AbortError` `DOMException` instead, as an aborted `fetch` does |
|
|
764
|
+
| `RedactedError` | What a streamed pending query rejects with when its server request failed |
|
|
765
|
+
| `QueryHandle<TFactory>` | Handle type for props |
|
|
766
|
+
| `EnsuredQueryHandle<TFactory>` | Handle type for props fed by `ensure` |
|
|
767
|
+
| `Thenable<T>` | Promise with `status` / `value` / `reason`, read by `use()` |
|
|
768
|
+
| `DataOf<TFactory>`, `InputOf<TFactory>`, `ErrorOf<TFactory>` | A factory's data, input and error types |
|
|
769
|
+
| `ServicesOf<TFactory>` | The services a factory's `queryFn` Effect needs; `never` for promises |
|
|
770
|
+
| `Register`, `QueryMeta` | Augment `Register` with `queryMeta` to type [`meta`](#query-meta) |
|
|
771
771
|
|
|
772
772
|
`@raf-query/react` (plus all of the above):
|
|
773
773
|
|
package/dist/client.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { unsafeCast } from "./cast.mjs";
|
|
2
2
|
import { QueryCache } from "@raf-query/core";
|
|
3
|
-
import { Context, Effect, Exit, Layer, Option, Scope } from "effect";
|
|
3
|
+
import { Context, Effect, Exit, Layer, Option, Predicate, Scope } from "effect";
|
|
4
4
|
//#region src/client.ts
|
|
5
5
|
/**
|
|
6
6
|
* A verb's Effect, run by a client. Its requirement is the factory's
|
|
@@ -11,6 +11,16 @@ function provided(effect) {
|
|
|
11
11
|
return unsafeCast(effect);
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
+
* Run a verb that waits on a request. A cancelled request rejects with an
|
|
15
|
+
* `AbortError`, as an aborted `fetch` does, not with the Effect API's
|
|
16
|
+
* `Query.CancelledError`.
|
|
17
|
+
*/
|
|
18
|
+
function runLoad(effect) {
|
|
19
|
+
return Effect.runPromise(effect).catch((error) => {
|
|
20
|
+
throw Predicate.isTagged(error, "CancelledError") ? new DOMException("The query was cancelled", "AbortError") : error;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
14
24
|
* The query cache, with Promise methods. Create one per request on the
|
|
15
25
|
* server and one per browser tab. `effect` is the same cache's Effect API.
|
|
16
26
|
* Its verbs take factories whose `queryFn` needs at most `TServices`, the
|
|
@@ -57,11 +67,11 @@ var QueryClient = class {
|
|
|
57
67
|
* directly.
|
|
58
68
|
*/
|
|
59
69
|
ensure(factory, ...args) {
|
|
60
|
-
return
|
|
70
|
+
return runLoad(provided(this.effect.ensure(factory, ...args)));
|
|
61
71
|
}
|
|
62
72
|
/** Like `ensure`, but resolves to the data. */
|
|
63
73
|
fetch(factory, ...args) {
|
|
64
|
-
return
|
|
74
|
+
return runLoad(provided(this.effect.fetch(factory, ...args)));
|
|
65
75
|
}
|
|
66
76
|
/**
|
|
67
77
|
* Mark queries stale and refetch the ones being read. Resolves once those
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raf-query/react",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "React bindings for raf-query, a render-as-you-fetch query library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"query",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@raf-query/core": "0.1
|
|
51
|
+
"@raf-query/core": "0.2.1"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@tanstack/react-router": "^1.170.0",
|