@nkzw/fate-indexeddb 1.12.0 → 1.12.2
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 +7 -1
- package/lib/index.d.mts +1 -3
- package/lib/index.mjs +1 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -880,6 +880,8 @@ function PostComments({
|
|
|
880
880
|
|
|
881
881
|
You can wrap a list of references using `useListView` to enable connection-style lists with pagination support.
|
|
882
882
|
|
|
883
|
+
Run the regular example with `vp run dev` (tRPC) or `vp run dev:graphql` (GraphQL), then open **Pagination** from its header (`http://localhost:6001/pagination/preview`). The demo uses the existing posts, client, and router to exercise independent view ranges, navigation, refreshes, and optimistic insertion and rollback. Reading and pagination work without signing in; insertions require an example account and successful insertions create real posts in its database. Browser network throttling makes pending work easier to observe.
|
|
884
|
+
|
|
883
885
|
For example, you can define a `CommentView` and reuse it inside of a `CommentConnectionView`:
|
|
884
886
|
|
|
885
887
|
```tsx
|
|
@@ -956,7 +958,11 @@ const CommentConnectionView = {
|
|
|
956
958
|
|
|
957
959
|
When `loadNext` runs, fate sends the next cursor as `after` and keeps the page size in `first`. When `loadPrevious` runs, fate sends the previous cursor as `before` and uses `last` for the page size. This lets the server distinguish forward and backward pagination while keeping the component API small.
|
|
958
960
|
|
|
959
|
-
|
|
961
|
+
Each logical view has its own requested window, identified by the view, connection, and original arguments. Calling `loadNext` or `loadPrevious` expands that window. Fate retains the loaded range with the cached connection, so returning to the same view after a remount restores its range. Fetching or paginating the same data through a different view does not expand the original view. Failed page loads leave the window unchanged and can be retried. Multiple readers of the same logical view share its pagination progress.
|
|
962
|
+
|
|
963
|
+
Queries share cached entities and compatible pages, but `first` and `last` still bound an ordinary request's result. A smaller preview refresh does not truncate pages already loaded by another reader. Partial refreshes update the fetched portion and retain cached continuation pages. A complete server result, including an empty result, can remove stale membership. These rules apply to nested connections and root lists.
|
|
964
|
+
|
|
965
|
+
Explicit mutation insertions remain visible beyond the initial page size and survive background refreshes. Insertions not yet reconciled with a server list remain local overrides, including across empty responses. Once the server has included an inserted entry, a later authoritative response covering that entry can remove it. Explicit deletions and relationship replacements also remove entries.
|
|
960
966
|
|
|
961
967
|
Additional arguments on a root request are scoped to that root list:
|
|
962
968
|
|
package/lib/index.d.mts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { PersistenceStorage } from "@nkzw/fate/persistence";
|
|
2
|
-
//#region src/index.d.ts
|
|
3
2
|
export type IndexedDBStorageOptions = Readonly<{
|
|
4
3
|
name?: string;
|
|
5
4
|
}>;
|
|
6
|
-
export declare function createIndexedDBStorage({ name }?: IndexedDBStorageOptions): PersistenceStorage;
|
|
7
|
-
//#endregion
|
|
5
|
+
export declare function createIndexedDBStorage({ name }?: IndexedDBStorageOptions): PersistenceStorage;
|
package/lib/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { openDB } from "idb";
|
|
2
|
-
|
|
2
|
+
// src/index.ts
|
|
3
3
|
function createIndexedDBStorage({ name = "fate" } = {}) {
|
|
4
4
|
let connectionLeases = 0;
|
|
5
5
|
let connection;
|
|
@@ -122,5 +122,4 @@ function createIndexedDBStorage({ name = "fate" } = {}) {
|
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
|
-
//#endregion
|
|
126
125
|
export { createIndexedDBStorage };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nkzw/fate-indexeddb",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.2",
|
|
4
4
|
"description": "Optional IndexedDB persistence adapter for fate.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"idb": "^8.0.4"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@nkzw/fate": "1.12.
|
|
22
|
+
"@nkzw/fate": "1.12.2",
|
|
23
23
|
"fake-indexeddb": "^6.2.6",
|
|
24
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@1.
|
|
25
|
-
"vite-plus": "1.
|
|
24
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
|
|
25
|
+
"vite-plus": "1.4.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@nkzw/fate": "^1.5.1"
|