diff --git a/app/studio/[[...index]]/Studio.tsx b/app/studio/[[...index]]/Studio.tsx new file mode 100644 index 00000000..abb666a4 --- /dev/null +++ b/app/studio/[[...index]]/Studio.tsx @@ -0,0 +1,18 @@ +'use client' + +/** + * This route is responsible for the built-in authoring environment using Sanity Studio. + * All routes under your studio path is handled by this file using Next.js' catch-all routes: + * https://nextjs.org/docs/routing/dynamic-routes#catch-all-routes + * + * You can learn more about the next-sanity package here: + * https://github.com/sanity-io/next-sanity + */ + +import { NextStudio } from 'next-sanity/studio' + +import config from '~/sanity.config' + +export default function Studio() { + return +} diff --git a/app/studio/[[...index]]/page.tsx b/app/studio/[[...index]]/page.tsx index 64332e7e..f1d57ae2 100644 --- a/app/studio/[[...index]]/page.tsx +++ b/app/studio/[[...index]]/page.tsx @@ -1,18 +1,11 @@ -'use client' +import Studio from './Studio' -/** - * This route is responsible for the built-in authoring environment using Sanity Studio. - * All routes under your studio path is handled by this file using Next.js' catch-all routes: - * https://nextjs.org/docs/routing/dynamic-routes#catch-all-routes - * - * You can learn more about the next-sanity package here: - * https://github.com/sanity-io/next-sanity - */ +// Ensures the Studio route is statically generated +export const dynamic = 'force-static' -import { NextStudio } from 'next-sanity/studio' - -import config from '~/sanity.config' +// Set the right `viewport`, `robots` and `referer` meta tags +export { metadata, viewport } from 'next-sanity/studio' export default function StudioPage() { - return + return } diff --git a/middleware.ts b/middleware.ts index 98d8771e..72e81ad4 100644 --- a/middleware.ts +++ b/middleware.ts @@ -56,6 +56,7 @@ export default authMiddleware({ beforeAuth: beforeAuthMiddleware, publicRoutes: [ '/', + '/studio(.*)', '/api(.*)', '/blog(.*)', '/confirm(.*)', diff --git a/next.config.mjs b/next.config.mjs index 4cae00be..454c4b39 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -17,6 +17,10 @@ const nextConfig = { ], }, + experimental: { + taint: true, + }, + redirects() { return [ { diff --git a/sanity.config.ts b/sanity.config.ts index d662ae00..a5c3d3d4 100644 --- a/sanity.config.ts +++ b/sanity.config.ts @@ -5,7 +5,7 @@ import { codeInput } from '@sanity/code-input' import { visionTool } from '@sanity/vision' import { defineConfig } from 'sanity' -import { deskTool } from 'sanity/desk' +import { structureTool } from 'sanity/structure' import { media } from 'sanity-plugin-media' import { settingsPlugin, settingsStructure } from '~/sanity/plugins/settings' @@ -22,9 +22,9 @@ export default defineConfig({ // Add and edit the content schema in the './sanity/schema' folder schema, plugins: [ - deskTool({ - structure: settingsStructure(settingsType), - }), + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-expect-error + structureTool({ structure: settingsStructure(settingsType) }), // Vision is a tool that lets you query your content with GROQ in the studio // https://www.sanity.io/docs/the-vision-plugin visionTool({ defaultApiVersion: apiVersion }), diff --git a/sanity/env.ts b/sanity/env.ts index 48a83561..246f8faa 100644 --- a/sanity/env.ts +++ b/sanity/env.ts @@ -1,6 +1,6 @@ import { env } from '~/env.mjs' -export const apiVersion = '2023-05-07' +export const apiVersion = '2024-02-12' export const dataset = assertValue( env.NEXT_PUBLIC_SANITY_DATASET, diff --git a/sanity/lib/client.ts b/sanity/lib/client.ts index d26e14e5..7e047d66 100644 --- a/sanity/lib/client.ts +++ b/sanity/lib/client.ts @@ -8,6 +8,7 @@ export const client = createClient({ dataset, projectId, useCdn, + perspective: 'published', }) // Wrap the cache function in a way that reuses the TypeScript definitions