Skip to content

Commit

Permalink
fix(deps): update dependency @sanity/client to ^6.22.2 (#1334)
Browse files Browse the repository at this point in the history
* fix(deps): update dependency @sanity/client to ^6.22.2

* chore: fix build error

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Cody Olsen <stipsan@gmail.com>
  • Loading branch information
renovate[bot] and stipsan authored Oct 17, 2024
1 parent 919f6bd commit 570d4c7
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 11 deletions.
5 changes: 3 additions & 2 deletions apps/next-app-router/app/DraftModeButton.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import {draftMode} from 'next/headers'
import {PreviewDraftsButton, ViewPublishedButton} from 'ui/react'

export default function DraftModeButton() {
export default async function DraftModeButton() {
const {isEnabled} = await draftMode()
return (
<form style={{display: 'contents'}}>
{draftMode().isEnabled ? (
{isEnabled ? (
<ViewPublishedButton formAction="/api/disable-draft" />
) : (
<PreviewDraftsButton formAction="/api/draft" />
Expand Down
2 changes: 1 addition & 1 deletion apps/next-app-router/app/api/disable-draft/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import {redirect} from 'next/navigation'
import {draftMode} from 'next/headers'

export async function GET(request: Request) {
draftMode().disable()
;(await draftMode()).disable()
redirect('/')
}
2 changes: 1 addition & 1 deletion apps/next-app-router/app/api/draft/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import {redirect} from 'next/navigation'
import {draftMode} from 'next/headers'

export async function GET(request: Request) {
draftMode().enable()
;(await draftMode()).enable()
redirect('/')
}
6 changes: 4 additions & 2 deletions apps/next-app-router/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ export default async function Page() {
query: footerQuery,
tags: ['pages'],
})
const {isEnabled} = await draftMode()

return (
<LiveStoreVariant>
<Suspense fallback={<TableFallback rows={Math.min(10, footer)} />}>
<ServerTable />
</Suspense>
<LiveQuery
enabled={draftMode().isEnabled}
enabled={isEnabled}
initialData={footer}
query={footerQuery}
as={PreviewFooter}
Expand All @@ -49,10 +50,11 @@ async function ServerTable() {
query: tableQuery,
tags: ['pages'],
})
const {isEnabled} = await draftMode()

return (
<LiveQuery
enabled={draftMode().isEnabled}
enabled={isEnabled}
initialData={data}
query={tableQuery}
as={PreviewTable}
Expand Down
2 changes: 1 addition & 1 deletion apps/next-app-router/app/sanity.fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function sanityFetch<QueryResponse>({
params?: QueryParams
tags: string[]
}): Promise<QueryResponse> {
const isDraftMode = draftMode().isEnabled
const {isEnabled: isDraftMode} = await draftMode()
if (isDraftMode && !token) {
throw new Error('The `SANITY_API_READ_TOKEN` environment variable is required.')
}
Expand Down
3 changes: 2 additions & 1 deletion apps/next-app-router/app/variants/live-store/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import {token} from '../../sanity.fetch'
const PreviewProvider = dynamic(() => import('./PreviewProvider'))

export default async function LiveStoreVariant({children}: React.PropsWithChildren) {
const {isEnabled} = await draftMode()
return (
<>
{draftMode().isEnabled ? (
{isEnabled ? (
<>
<PreviewProvider token={token}>{children}</PreviewProvider>
<VisualEditing />
Expand Down
4 changes: 2 additions & 2 deletions packages/preview-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"mendoza": "3.0.7"
},
"devDependencies": {
"@sanity/client": "^6.22.1",
"@sanity/client": "^6.22.2",
"@sanity/pkg-utils": "6.11.3",
"@sanity/prettier-config": "^1.0.3",
"@sanity/semantic-release-preset": "^5.0.0",
Expand Down Expand Up @@ -120,7 +120,7 @@
"vitest-github-actions-reporter": "^0.11.1"
},
"peerDependencies": {
"@sanity/client": "^6.22.1",
"@sanity/client": "^6.22.2",
"react": "^18.0.0 || >=19.0.0-rc"
},
"peerDependenciesMeta": {
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 570d4c7

Please sign in to comment.