@spoosh/plugin-optimistic 0.1.0-beta.0 → 0.1.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 +6 -1
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -18,10 +18,15 @@ Note: This plugin requires `@spoosh/plugin-invalidation` as a peer dependency.
|
|
|
18
18
|
## Usage
|
|
19
19
|
|
|
20
20
|
```typescript
|
|
21
|
+
import { Spoosh } from "@spoosh/core";
|
|
21
22
|
import { optimisticPlugin } from "@spoosh/plugin-optimistic";
|
|
22
23
|
import { invalidationPlugin } from "@spoosh/plugin-invalidation";
|
|
23
24
|
|
|
24
|
-
const
|
|
25
|
+
const client = new Spoosh<ApiSchema, Error>("/api")
|
|
26
|
+
.use([
|
|
27
|
+
invalidationPlugin(),
|
|
28
|
+
optimisticPlugin(),
|
|
29
|
+
]);
|
|
25
30
|
|
|
26
31
|
const { trigger } = useWrite((api) => api.posts[id].$delete);
|
|
27
32
|
|
package/dist/index.d.mts
CHANGED
|
@@ -53,7 +53,13 @@ declare const OPTIMISTIC_SNAPSHOTS_KEY = "optimistic:snapshots";
|
|
|
53
53
|
*
|
|
54
54
|
* @example
|
|
55
55
|
* ```ts
|
|
56
|
-
*
|
|
56
|
+
* import { Spoosh } from "@spoosh/core";
|
|
57
|
+
*
|
|
58
|
+
* const client = new Spoosh<ApiSchema, Error>("/api")
|
|
59
|
+
* .use([
|
|
60
|
+
* // ... other plugins
|
|
61
|
+
* optimisticPlugin(),
|
|
62
|
+
* ]);
|
|
57
63
|
*
|
|
58
64
|
* // In useWrite - autoInvalidate defaults to "none" when optimistic is used
|
|
59
65
|
* trigger({
|
package/dist/index.d.ts
CHANGED
|
@@ -53,7 +53,13 @@ declare const OPTIMISTIC_SNAPSHOTS_KEY = "optimistic:snapshots";
|
|
|
53
53
|
*
|
|
54
54
|
* @example
|
|
55
55
|
* ```ts
|
|
56
|
-
*
|
|
56
|
+
* import { Spoosh } from "@spoosh/core";
|
|
57
|
+
*
|
|
58
|
+
* const client = new Spoosh<ApiSchema, Error>("/api")
|
|
59
|
+
* .use([
|
|
60
|
+
* // ... other plugins
|
|
61
|
+
* optimisticPlugin(),
|
|
62
|
+
* ]);
|
|
57
63
|
*
|
|
58
64
|
* // In useWrite - autoInvalidate defaults to "none" when optimistic is used
|
|
59
65
|
* trigger({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spoosh/plugin-optimistic",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Optimistic updates plugin for Spoosh - instant UI updates with automatic rollback",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@spoosh/core": ">=0.
|
|
37
|
-
"@spoosh/plugin-invalidation": ">=
|
|
36
|
+
"@spoosh/core": ">=0.3.0",
|
|
37
|
+
"@spoosh/plugin-invalidation": ">=1.0.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@spoosh/core": "0.
|
|
41
|
-
"@spoosh/
|
|
42
|
-
"@spoosh/
|
|
40
|
+
"@spoosh/core": "0.3.0",
|
|
41
|
+
"@spoosh/test-utils": "0.1.3",
|
|
42
|
+
"@spoosh/plugin-invalidation": "0.1.2"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"dev": "tsup --watch",
|