@easy-cms/next 0.66.0 → 0.66.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/README.md +15 -4
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -38,12 +38,21 @@ export const { GET, HEAD } = createAdminRouteHandlers(config)
|
|
|
38
38
|
**3. Read content in Server Components** with the typed Local API:
|
|
39
39
|
|
|
40
40
|
```tsx
|
|
41
|
+
import { connection } from 'next/server'
|
|
42
|
+
import { Suspense } from 'react'
|
|
41
43
|
import { getEasyCMS, getEasyCMSUser } from '@easy-cms/next'
|
|
42
44
|
import config from '@/easy-cms.config'
|
|
43
45
|
|
|
44
|
-
export
|
|
46
|
+
export default function Page() {
|
|
47
|
+
return (
|
|
48
|
+
<Suspense>
|
|
49
|
+
<Posts />
|
|
50
|
+
</Suspense>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
45
53
|
|
|
46
|
-
|
|
54
|
+
async function Posts() {
|
|
55
|
+
await connection() // read on each request
|
|
47
56
|
const cms = await getEasyCMS(config)
|
|
48
57
|
const { docs } = await cms.find('posts', { limit: 10 })
|
|
49
58
|
const user = await getEasyCMSUser(config) // logged-in Easy CMS user or null
|
|
@@ -51,8 +60,10 @@ export default async function Page() {
|
|
|
51
60
|
}
|
|
52
61
|
```
|
|
53
62
|
|
|
54
|
-
Pages that read from the CMS should
|
|
55
|
-
|
|
63
|
+
Pages that read from the CMS should render per request: `await connection()` in a component
|
|
64
|
+
inside `<Suspense>`, as above (or cache on purpose with revalidation). Otherwise `next build`
|
|
65
|
+
tries to query the database while prerendering. This works whether or not `cacheComponents` is on;
|
|
66
|
+
new apps from `create-next-app` have it on, and there `export const dynamic` is not allowed.
|
|
56
67
|
|
|
57
68
|
`createRouteHandlers(config, { trustProxy: true })` uses `X-Forwarded-For` for login rate limiting;
|
|
58
69
|
enable it behind a proxy you trust (Vercel and Netlify are recognized without it). It also takes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easy-cms/next",
|
|
3
|
-
"version": "0.66.
|
|
3
|
+
"version": "0.66.1",
|
|
4
4
|
"description": "Next.js adapter for Easy CMS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
"node": ">=22.12"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@easy-cms/admin": "^0.66.
|
|
29
|
+
"@easy-cms/admin": "^0.66.1"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"next": ">=15.0.0",
|
|
33
33
|
"react": ">=19.0.0",
|
|
34
|
-
"@easy-cms/core": "^0.66.
|
|
34
|
+
"@easy-cms/core": "^0.66.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/react": "^19.2.0",
|
|
38
38
|
"next": "^16.3.8",
|
|
39
39
|
"react": "^19.2.0",
|
|
40
|
-
"@easy-cms/core": "^0.66.
|
|
41
|
-
"@easy-cms/db-sqlite": "^0.66.
|
|
40
|
+
"@easy-cms/core": "^0.66.1",
|
|
41
|
+
"@easy-cms/db-sqlite": "^0.66.1"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|