@nkzw/fate-indexeddb 1.12.2 → 1.13.0
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 +21 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -874,6 +874,8 @@ function PostComments({
|
|
|
874
874
|
|
|
875
875
|
`useView` and `useLiveListView` can read deferred values too. This works with every transport. GraphQL currently fetches deferred fields with separate queries, rather than streaming `@defer` responses.
|
|
876
876
|
|
|
877
|
+
For GraphQL servers with incremental delivery enabled, [streaming batched reads](/docs/integrations/graphql.md#streaming-batched-reads) allows deferred follow-up requests to resolve independently within one HTTP response. This does not change when a deferred field is read or require different React hooks.
|
|
878
|
+
|
|
877
879
|
## List Views
|
|
878
880
|
|
|
879
881
|
### Pagination with `useListView`
|
|
@@ -2221,6 +2223,25 @@ Queries made together are batched into one GraphQL operation. Mutations run sepa
|
|
|
2221
2223
|
|
|
2222
2224
|
[Deferred fields](/docs/guide/deferred-views.md) load when a component reads them. This uses ordinary GraphQL queries; incremental `@defer` responses are not supported yet.
|
|
2223
2225
|
|
|
2226
|
+
### Streaming Batched Reads
|
|
2227
|
+
|
|
2228
|
+
For a server that supports GraphQL `@defer` and the `v0.2` incremental delivery protocol, enable streaming when creating your client:
|
|
2229
|
+
|
|
2230
|
+
```tsx
|
|
2231
|
+
const fate = createFateClient({
|
|
2232
|
+
streaming: true,
|
|
2233
|
+
url: 'https://api.example.com/graphql',
|
|
2234
|
+
});
|
|
2235
|
+
```
|
|
2236
|
+
|
|
2237
|
+
Reads still share one HTTP request. Each read is wrapped in its own labeled `@defer` fragment and resolves when that operation's complete result arrives. Separate requests under separate Suspense boundaries can render independently, while one request continues to wait for all the data it declares.
|
|
2238
|
+
|
|
2239
|
+
The transport negotiates `multipart/mixed;incrementalSpec=v0.2` and also accepts complete JSON responses. Mutations continue to use ordinary JSON responses. Streaming is disabled by default; enable it only after configuring your server and verifying that your proxy forwards response chunks promptly. Unsupported directives and incompatible multipart protocols produce errors rather than silently retrying requests.
|
|
2240
|
+
|
|
2241
|
+
With GraphQL Yoga, install `@graphql-yoga/plugin-defer-stream` and add `useDeferStream()` to the server's plugins. Keep client timeouts and error boundaries in place: completed reads remain available if another operation fails or the connection ends, while unfinished reads reject. Canceling one read keeps the connection alive for its siblings; the connection is released when no reads still need it.
|
|
2242
|
+
|
|
2243
|
+
This mode delivers complete operation results through the existing normalized cache. Field-level patches and item-by-item `@stream` updates are not supported. Existing fate `defer()` selections remain lazy identity-based follow-up reads, which can themselves share a streaming batch.
|
|
2244
|
+
|
|
2224
2245
|
### Refetch Fields
|
|
2225
2246
|
|
|
2226
2247
|
For servers without `nodes(ids:)`, configure a query field for each refetchable entity type:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nkzw/fate-indexeddb",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "Optional IndexedDB persistence adapter for fate.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"idb": "^8.0.4"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@nkzw/fate": "1.
|
|
22
|
+
"@nkzw/fate": "1.13.0",
|
|
23
23
|
"fake-indexeddb": "^6.2.6",
|
|
24
24
|
"vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
|
|
25
25
|
"vite-plus": "1.4.0"
|