Releases: sanity-io/next-sanity
Releases · sanity-io/next-sanity
v3.0.1
v3.0.0
3.0.0 (2022-11-22)
⚠ BREAKING CHANGES
- See the Migration section in the README for details.
Features
- add support for Next 13
appDir
(#184) (0c80876), closes /github.com/sanity-io/next-sanity/tree/main#from-v2
This release is also available on:
v2.1.0
v2.0.2
v2.0.1
v2.0.0
2.0.0 (2022-11-16)
⚠ BREAKING CHANGES
Check the full migration guide for details.
- Requires Node
v16
, likeNext 13
. createPreviewSubscriptionHook
is replaced withdefinePreview
.createCurrentUserHook
is removed
Features
- add new preview mode for Next 13 (#152) (9eae92a), closes #next-12 #65 #4 #8 #16 #53 #46 #35 #22 #154
Bug Fixes
v1.1.0
v1.1.0-add-type-allowlist.1
1.1.0-add-type-allowlist.1 (2022-11-14)
Features
- add support for fetching subset of dataset by type (8416e74)
Bug Fixes
This release is also available on:
v2.0.0-preview-kit.1
2.0.0-preview-kit.1 (2022-11-11)
⚠ BREAKING CHANGES
- General purpose preview mode is now maintained in
@sanity/preview-kit
. Use it on routes that don't live inside the/app
folder introduced in Next 13.
The new mode for Next 13 provides two new APIs that supportsReact.use
andReact.cache
as implemented in Next 13 React Server Components:
import {PreviewSuspense, definePreview, groq} from 'next-sanity'
import {previewData} from 'next/headers'
const usePreview = definePreview({projectId, dataset})
export default async function ServerComponent() {
const token = previewData()?.token
if(token) return <PreviewSuspense fallback="Loading Preview Mode..."><PreviewList token={token} /></PreviewSuspense>
const client = createClient({projectId, dataset})
const data = await client.fetch(groq`*[]`)
return <List data={data} />
}
function PreviewList({token}) {
const data = usePreview(token, groq`*[]`)
return <List data={data} />
}
Features
- add new preview mode for Next 13 (a22ddb3)
Bug Fixes
This release is also available on: