next-sanity 5.5.3 → 5.5.5

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.
Files changed (2) hide show
  1. package/README.md +6 -7
  2. package/package.json +19 -20
package/README.md CHANGED
@@ -106,7 +106,7 @@ const projectId = process.env.NEXT_PUBLIC_SANITY_PROJECT_ID // "pv8y60vp"
106
106
  const dataset = process.env.NEXT_PUBLIC_SANITY_DATASET // "production"
107
107
  const apiVersion = process.env.NEXT_PUBLIC_SANITY_API_VERSION || '2023-05-03'
108
108
 
109
- const client = createClient({
109
+ export const client = createClient({
110
110
  projectId,
111
111
  dataset,
112
112
  apiVersion, // https://www.sanity.io/docs/api-versioning
@@ -225,9 +225,9 @@ type HomePageProps = {
225
225
 
226
226
  export async function HomeLayout({children}) {
227
227
  const home = await client.fetch<HomePageProps>(`*[_id == "home"][0]{...,navItems[]->}`,
228
- next: {
228
+ {next: {
229
229
  revalidate: 3600 // look for updates to revalidate cache every hour
230
- }
230
+ }}
231
231
  })
232
232
 
233
233
  return (
@@ -337,7 +337,7 @@ You can use this [template][webhook-template] to quickly configure the webhook f
337
337
  The code example below uses the built-in `parseBody` function to validate that the request comes from your Sanity project (using a shared secret + looking at the request headers). Then it looks at the document type information in the webhook payload and matches that against the revalidation tags in your app:
338
338
 
339
339
  ```ts
340
- // ./src/app/api/revalidate.ts
340
+ // ./src/app/api/revalidate/route.ts
341
341
  import {revalidateTag} from 'next/cache'
342
342
  import {type NextRequest, NextResponse} from 'next/server'
343
343
  import {parseBody} from 'next-sanity/webhook'
@@ -361,7 +361,7 @@ export async function POST(req: NextRequest) {
361
361
 
362
362
  // If the `_type` is `page`, then all `client.fetch` calls with
363
363
  // `{next: {tags: ['page']}}` will be revalidated
364
- await revalidateTag(body._type)
364
+ revalidateTag(body._type)
365
365
 
366
366
  return NextResponse.json({body})
367
367
  } catch (err) {
@@ -472,7 +472,6 @@ import 'server-only'
472
472
  import {draftMode} from 'next/headers'
473
473
  import type {QueryParams} from '@sanity/client'
474
474
  import {createClient, groq} from 'next-sanity'
475
- import {draftMode} from 'next/headers'
476
475
 
477
476
  const projectId = process.env.NEXT_PUBLIC_SANITY_PROJECT_ID // "pv8y60vp"
478
477
  const dataset = process.env.NEXT_PUBLIC_SANITY_DATASET // "production"
@@ -520,11 +519,11 @@ export async function sanityFetch<QueryResponse>({
520
519
  })
521
520
  }
522
521
  ```
522
+
523
523
  #### Using `cache` and `revalidation` at the same time
524
524
 
525
525
  Be aware that you can get errors if you use the `cache` and the `revalidate` configurations for Next.js cache at the same time. Go to [the Next.js docs][next-revalidate-docs] to learn more.
526
526
 
527
-
528
527
  ## Visual Editing with Content Source Maps
529
528
 
530
529
  > **Note**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-sanity",
3
- "version": "5.5.3",
3
+ "version": "5.5.5",
4
4
  "description": "Sanity.io toolkit for Next.js",
5
5
  "keywords": [
6
6
  "sanity",
@@ -177,25 +177,24 @@
177
177
  "@sanity/preview-kit": "3.1.6",
178
178
  "@sanity/webhook": "3.0.1",
179
179
  "groq": "^3.0.0",
180
- "@sanity/client": "^6.4.11"
180
+ "@sanity/client": "^6.4.12"
181
181
  },
182
182
  "devDependencies": {
183
- "@next/bundle-analyzer": "^13.4.19",
184
- "@next/eslint-plugin-next": "13.4.19",
183
+ "@next/bundle-analyzer": "^13.5.4",
184
+ "@next/eslint-plugin-next": "13.5.4",
185
185
  "@rollup/plugin-url": "^8.0.1",
186
186
  "@sanity/eslint-config-studio": "^3.0.1",
187
187
  "@sanity/image-url": "^1.0.2",
188
- "@sanity/pkg-utils": "^2.4.8",
188
+ "@sanity/pkg-utils": "^2.4.9",
189
189
  "@sanity/ui": "^1.8.2",
190
- "@sanity/vision": "3.16.4",
191
- "@types/eventsource": "^1.1.11",
192
- "@types/jest": "^29.5.4",
193
- "@types/react": "^18.2.21",
194
- "@types/react-dom": "^18.2.7",
195
- "@types/styled-components": "^5.1.27",
196
- "@typescript-eslint/eslint-plugin": "^6.7.0",
197
- "autoprefixer": "^10.4.15",
198
- "eslint": "^8.49.0",
190
+ "@sanity/vision": "3.17.0",
191
+ "@types/jest": "^29.5.5",
192
+ "@types/react": "^18.2.24",
193
+ "@types/react-dom": "^18.2.8",
194
+ "@types/styled-components": "^5.1.28",
195
+ "@typescript-eslint/eslint-plugin": "^6.7.4",
196
+ "autoprefixer": "^10.4.16",
197
+ "eslint": "^8.50.0",
199
198
  "eslint-config-prettier": "^9.0.0",
200
199
  "eslint-config-sanity": "^6.0.0",
201
200
  "eslint-gitignore": "^0.1.0",
@@ -205,16 +204,16 @@
205
204
  "jest": "^29.7.0",
206
205
  "jest-environment-jsdom": "^29.7.0",
207
206
  "ls-engines": "^0.9.0",
208
- "next": "13.4.19",
209
- "postcss": "^8.4.29",
207
+ "next": "13.5.4",
208
+ "postcss": "^8.4.31",
210
209
  "prettier": "^3.0.3",
211
- "prettier-plugin-packagejson": "^2.4.5",
212
- "prettier-plugin-tailwindcss": "^0.5.4",
210
+ "prettier-plugin-packagejson": "^2.4.6",
211
+ "prettier-plugin-tailwindcss": "^0.5.5",
213
212
  "react": "^18.2.0",
214
213
  "react-dom": "^18.2.0",
215
214
  "react-is": "^18.2.0",
216
- "rollup": "^3.29.1",
217
- "sanity": "3.16.4",
215
+ "rollup": "^3.29.4",
216
+ "sanity": "3.17.0",
218
217
  "server-only": "^0.0.1",
219
218
  "styled-components": "^5.3.11",
220
219
  "suspend-react": "^0.1.3",