Skip to content

Commit

Permalink
chore: update sanity
Browse files Browse the repository at this point in the history
  • Loading branch information
CaliCastle committed Mar 13, 2024
1 parent aa9adfb commit fe22a37
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 18 deletions.
18 changes: 18 additions & 0 deletions app/studio/[[...index]]/Studio.tsx
Original file line number Diff line number Diff line change
@@ -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 <NextStudio config={config} />
}
19 changes: 6 additions & 13 deletions app/studio/[[...index]]/page.tsx
Original file line number Diff line number Diff line change
@@ -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 <NextStudio config={config} />
return <Studio />
}
1 change: 1 addition & 0 deletions middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export default authMiddleware({
beforeAuth: beforeAuthMiddleware,
publicRoutes: [
'/',
'/studio(.*)',
'/api(.*)',
'/blog(.*)',
'/confirm(.*)',
Expand Down
4 changes: 4 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ const nextConfig = {
],
},

experimental: {
taint: true,
},

redirects() {
return [
{
Expand Down
8 changes: 4 additions & 4 deletions sanity.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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 }),
Expand Down
2 changes: 1 addition & 1 deletion sanity/env.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
1 change: 1 addition & 0 deletions sanity/lib/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fe22a37

Please sign in to comment.