From 570d4c765161faa77d415d849a2d820d965036d3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 17 Oct 2024 11:16:59 +0200 Subject: [PATCH] fix(deps): update dependency @sanity/client to ^6.22.2 (#1334) * 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 --- apps/next-app-router/app/DraftModeButton.tsx | 5 +++-- apps/next-app-router/app/api/disable-draft/route.ts | 2 +- apps/next-app-router/app/api/draft/route.ts | 2 +- apps/next-app-router/app/page.tsx | 6 ++++-- apps/next-app-router/app/sanity.fetch.ts | 2 +- apps/next-app-router/app/variants/live-store/index.tsx | 3 ++- packages/preview-kit/package.json | 4 ++-- pnpm-lock.yaml | 2 +- 8 files changed, 15 insertions(+), 11 deletions(-) diff --git a/apps/next-app-router/app/DraftModeButton.tsx b/apps/next-app-router/app/DraftModeButton.tsx index c3b3cef0..18ea35e0 100644 --- a/apps/next-app-router/app/DraftModeButton.tsx +++ b/apps/next-app-router/app/DraftModeButton.tsx @@ -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 (
- {draftMode().isEnabled ? ( + {isEnabled ? ( ) : ( diff --git a/apps/next-app-router/app/api/disable-draft/route.ts b/apps/next-app-router/app/api/disable-draft/route.ts index 7082666b..55522184 100644 --- a/apps/next-app-router/app/api/disable-draft/route.ts +++ b/apps/next-app-router/app/api/disable-draft/route.ts @@ -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('/') } diff --git a/apps/next-app-router/app/api/draft/route.ts b/apps/next-app-router/app/api/draft/route.ts index e04cb9c7..a339278d 100644 --- a/apps/next-app-router/app/api/draft/route.ts +++ b/apps/next-app-router/app/api/draft/route.ts @@ -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('/') } diff --git a/apps/next-app-router/app/page.tsx b/apps/next-app-router/app/page.tsx index ccf674a5..3500e551 100644 --- a/apps/next-app-router/app/page.tsx +++ b/apps/next-app-router/app/page.tsx @@ -23,6 +23,7 @@ export default async function Page() { query: footerQuery, tags: ['pages'], }) + const {isEnabled} = await draftMode() return ( @@ -30,7 +31,7 @@ export default async function Page() { ({ params?: QueryParams tags: string[] }): Promise { - const isDraftMode = draftMode().isEnabled + const {isEnabled: isDraftMode} = await draftMode() if (isDraftMode && !token) { throw new Error('The `SANITY_API_READ_TOKEN` environment variable is required.') } diff --git a/apps/next-app-router/app/variants/live-store/index.tsx b/apps/next-app-router/app/variants/live-store/index.tsx index 870d2c98..114fc843 100644 --- a/apps/next-app-router/app/variants/live-store/index.tsx +++ b/apps/next-app-router/app/variants/live-store/index.tsx @@ -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 ? ( <> {children} diff --git a/packages/preview-kit/package.json b/packages/preview-kit/package.json index 909b912b..71fa2fd2 100644 --- a/packages/preview-kit/package.json +++ b/packages/preview-kit/package.json @@ -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", @@ -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": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 12042065..6e31fdc2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -262,7 +262,7 @@ importers: version: 3.0.7 devDependencies: '@sanity/client': - specifier: ^6.22.1 + specifier: ^6.22.2 version: 6.22.2(debug@4.3.6) '@sanity/pkg-utils': specifier: 6.11.3