@spoosh/plugin-nextjs 0.1.2 → 0.1.4
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 +15 -18
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -30,11 +30,10 @@ import { Spoosh } from "@spoosh/core";
|
|
|
30
30
|
import { nextjsPlugin } from "@spoosh/plugin-nextjs";
|
|
31
31
|
import { invalidationPlugin } from "@spoosh/plugin-invalidation";
|
|
32
32
|
|
|
33
|
-
const client = new Spoosh<ApiSchema, Error>("/api")
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
]);
|
|
33
|
+
const client = new Spoosh<ApiSchema, Error>("/api").use([
|
|
34
|
+
invalidationPlugin(),
|
|
35
|
+
nextjsPlugin({ serverRevalidator: revalidateAction }),
|
|
36
|
+
]);
|
|
38
37
|
|
|
39
38
|
// After a successful mutation, cache tags are automatically revalidated
|
|
40
39
|
const { trigger } = useWrite((api) => api.posts.$post);
|
|
@@ -74,13 +73,12 @@ For apps that primarily fetch data on the client side, set `skipServerRevalidati
|
|
|
74
73
|
import { Spoosh } from "@spoosh/core";
|
|
75
74
|
import { nextjsPlugin } from "@spoosh/plugin-nextjs";
|
|
76
75
|
|
|
77
|
-
const client = new Spoosh<ApiSchema, Error>("/api")
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
]);
|
|
76
|
+
const client = new Spoosh<ApiSchema, Error>("/api").use([
|
|
77
|
+
nextjsPlugin({
|
|
78
|
+
serverRevalidator: revalidate,
|
|
79
|
+
skipServerRevalidation: true,
|
|
80
|
+
}),
|
|
81
|
+
]);
|
|
84
82
|
|
|
85
83
|
// Most mutations don't need server revalidation
|
|
86
84
|
await trigger({ body: data });
|
|
@@ -100,12 +98,11 @@ For apps that rely heavily on server-side rendering or React Server Components,
|
|
|
100
98
|
import { Spoosh } from "@spoosh/core";
|
|
101
99
|
import { nextjsPlugin } from "@spoosh/plugin-nextjs";
|
|
102
100
|
|
|
103
|
-
const client = new Spoosh<ApiSchema, Error>("/api")
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
]);
|
|
101
|
+
const client = new Spoosh<ApiSchema, Error>("/api").use([
|
|
102
|
+
nextjsPlugin({
|
|
103
|
+
serverRevalidator: revalidate,
|
|
104
|
+
}),
|
|
105
|
+
]);
|
|
109
106
|
|
|
110
107
|
// Server cache is revalidated by default
|
|
111
108
|
await trigger({ body: data });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spoosh/plugin-nextjs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Next.js integration plugin for Spoosh - server revalidation after mutations",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/nxnom/spoosh/issues"
|
|
13
13
|
},
|
|
14
|
-
"homepage": "https://spoosh.dev/docs/plugins/nextjs",
|
|
14
|
+
"homepage": "https://spoosh.dev/react/docs/plugins/nextjs",
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@spoosh/core": ">=0.
|
|
37
|
+
"@spoosh/core": ">=0.4.0",
|
|
38
38
|
"next": ">=13.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@spoosh/core": "0.
|
|
41
|
+
"@spoosh/core": "0.4.2"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"dev": "tsup --watch",
|