f14f62838a
Documents how to setup GROQ webhooks that revalidates ISR routes on-demand. It's trivial to do this for posts as you only need to lookup the `slug` based on the `id` you receive in the webhook payload. When editing authors the GROQ query demonstrates how you can do a reverse lookup (find all pages that reference the edited author) then invalidate their routes. This work is based on https://github.com/sanity-io/structured-content-2022/pull/105, thanks @j0nas! 🎉 [Test **Deploy with Vercel**](https://vercel.com/new/git/external?repository-url=https://github.com/stipsan/next.js/tree/add-on-demand-ISR-to-cms-sanity/examples/cms-sanity&project-name=cms-sanity&repository-name=cms-sanity&env=NEXT_PUBLIC_SANITY_PROJECT_ID,SANITY_API_TOKEN,SANITY_PREVIEW_SECRET,SANITY_STUDIO_REVALIDATE_SECRET&envDescription=Required%20to%20connect%20the%20app%20with%20Sanity&envLink=https://vercel.link/cms-sanity-env) ## Documentation / Examples - [x] Make sure the linting passes by running `yarn lint` Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
24 lines
509 B
JSON
24 lines
509 B
JSON
{
|
|
"private": true,
|
|
"scripts": {
|
|
"dev": "next",
|
|
"build": "next build",
|
|
"start": "next start"
|
|
},
|
|
"dependencies": {
|
|
"@portabletext/react": "^1.0.3",
|
|
"@sanity/image-url": "^1.0.1",
|
|
"@sanity/webhook": "^1.0.2",
|
|
"classnames": "2.3.1",
|
|
"date-fns": "2.28.0",
|
|
"next": "latest",
|
|
"next-sanity": "0.5.0",
|
|
"react": "^17.0.2",
|
|
"react-dom": "^17.0.2"
|
|
},
|
|
"devDependencies": {
|
|
"autoprefixer": "10.4.2",
|
|
"postcss": "8.4.7",
|
|
"tailwindcss": "^3.0.23"
|
|
}
|
|
}
|